diff --git a/usr.sbin/ppp/auth.c b/usr.sbin/ppp/auth.c index 3f25dbc2ba4c..4ab98f2e33a5 100644 --- a/usr.sbin/ppp/auth.c +++ b/usr.sbin/ppp/auth.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id$ + * $Id: auth.c,v 1.10 1997/02/22 16:10:01 peter Exp $ * * TODO: * o Implement check against with registered IP addresses. @@ -68,7 +68,7 @@ LocalAuthValidate( char *fname, char *system, char *key) { continue; buff[strlen(buff)-1] = 0; bzero(vector, sizeof(vector)); - n = MakeArgs(buff, vector); + n = MakeArgs(buff, vector, VECSIZE(vector)); if (n < 1) continue; if (strcmp(vector[0], system) == 0) { @@ -102,7 +102,7 @@ char *fname, *system, *key; continue; buff[strlen(buff)-1] = 0; bzero(vector, sizeof(vector)); - n = MakeArgs(buff, vector); + n = MakeArgs(buff, vector, VECSIZE(vector)); if (n < 2) continue; if (strcmp(vector[0], system) == 0) { @@ -143,7 +143,7 @@ int len, setaddr; continue; buff[strlen(buff)-1] = 0; bzero(vector, sizeof(vector)); - n = MakeArgs(buff, vector); + n = MakeArgs(buff, vector, VECSIZE(vector)); if (n < 2) continue; if (strlen(vector[0]) == len && strncmp(vector[0], system, len) == 0) { diff --git a/usr.sbin/ppp/chat.c b/usr.sbin/ppp/chat.c index d86580162c40..4e1a24f36072 100644 --- a/usr.sbin/ppp/chat.c +++ b/usr.sbin/ppp/chat.c @@ -18,7 +18,7 @@ * Columbus, OH 43221 * (614)451-1883 * - * $Id: chat.c,v 1.21 1997/03/09 20:09:14 ache Exp $ + * $Id: chat.c,v 1.22 1997/03/13 12:45:28 brian Exp $ * * TODO: * o Support more UUCP compatible control sequences. @@ -39,6 +39,7 @@ #include "timeout.h" #include "vars.h" #include "sig.h" +#include "chat.h" #define IBSIZE 200 @@ -80,9 +81,10 @@ int instring; } int -MakeArgs(script, pvect) +MakeArgs(script, pvect, maxargs) char *script; char **pvect; +int maxargs; { int nargs, nb; int instring; @@ -96,9 +98,11 @@ char **pvect; instring = 1; script++; if (*script == '\0') - return(nargs); + break; /* Shouldn't return here. Need to null terminate below */ } else instring = 0; + if (nargs >= maxargs-1) + break; *pvect++ = script; nargs++; script = findblank(script, instring); @@ -398,7 +402,7 @@ char *command, *out; cp--; } snprintf(tmp, sizeof tmp, "%s %s", command, cp); - (void) MakeArgs(tmp, &vector); + (void) MakeArgs(tmp, vector, VECSIZE(vector)); pipe(fids); pid = fork(); @@ -544,7 +548,7 @@ int DoChat(script) char *script; { - char *vector[20]; + char *vector[40]; char **argv; int argc, n, state; #ifdef DEBUG @@ -559,7 +563,7 @@ char *script; numaborts = 0; bzero(vector, sizeof(vector)); - n = MakeArgs(script, &vector); + n = MakeArgs(script, vector, VECSIZE(vector)); #ifdef DEBUG logprintf("n = %d\n", n); for (i = 0; i < n; i++) diff --git a/usr.sbin/ppp/chat.h b/usr.sbin/ppp/chat.h index ddc5a23a27ca..14ddc396cb3d 100644 --- a/usr.sbin/ppp/chat.h +++ b/usr.sbin/ppp/chat.h @@ -18,12 +18,13 @@ * Columbus, OH 43221 * (614)451-1883 * - * $Id$ + * $Id: chat.h,v 1.4 1997/02/22 16:10:07 peter Exp $ * */ #ifndef _CHAT_H_ #define _CHAT_H_ #include "cdefs.h" extern char * ExpandString __P((char *, char *, int, int)); -extern int MakeArgs __P((char *, char **)); +extern int MakeArgs __P((char *, char **, int)); +#define VECSIZE(v) (sizeof(v) / sizeof(v[0])) #endif diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index 032fd2ab3093..f861f4fc6b1b 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: command.c,v 1.38 1997/04/14 23:48:12 brian Exp $ + * $Id: command.c,v 1.39 1997/04/21 01:01:40 brian Exp $ * */ #include @@ -41,8 +41,8 @@ #include #include "os.h" #include +#include "chat.h" -extern int MakeArgs(); extern void Cleanup(), TtyTermMode(), PacketMode(); extern int EnableCommand(), DisableCommand(), DisplayCommand(); extern int AcceptCommand(), DenyCommand(); @@ -555,7 +555,7 @@ int prompt; if (cp) *cp = '\0'; { - argc = MakeArgs(buff, &vector); + argc = MakeArgs(buff, vector, VECSIZE(vector)); argv = vector; if (argc > 0)