summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/chat.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-05-07 23:01:25 +0000
committerbrian <brian@FreeBSD.org>1997-05-07 23:01:25 +0000
commitc0df205f61114f6e2e8e0e81b742de41d87cfcca (patch)
tree47c107aa11ed1373a1bdb81a124d4c753409711b /usr.sbin/ppp/chat.c
parent605e9c6e8fbf82421ae4b271a7a7d47664f9062e (diff)
downloadFreeBSD-src-c0df205f61114f6e2e8e0e81b742de41d87cfcca.zip
FreeBSD-src-c0df205f61114f6e2e8e0e81b742de41d87cfcca.tar.gz
Allow up to 40 args in the chat script (was 20).
Ignore subsequent args rather than scribbling. PR: 1952 Submitted by: Mikael Hybsch <micke@free.dynas.se>
Diffstat (limited to 'usr.sbin/ppp/chat.c')
-rw-r--r--usr.sbin/ppp/chat.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/usr.sbin/ppp/chat.c b/usr.sbin/ppp/chat.c
index d865801..4e1a24f 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++)
OpenPOWER on IntegriCloud