diff options
author | brian <brian@FreeBSD.org> | 1999-12-20 20:30:02 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1999-12-20 20:30:02 +0000 |
commit | 4145fb0c1be9e8321d6d4e6f465453c2cc0aed50 (patch) | |
tree | fce823325831d2a7126e8d74c67c40f44d69b13c /usr.sbin/ppp/chat.c | |
parent | ff8174b1b3e9f7d40f556d9af0d8168f7b81cefa (diff) | |
download | FreeBSD-src-4145fb0c1be9e8321d6d4e6f465453c2cc0aed50.zip FreeBSD-src-4145fb0c1be9e8321d6d4e6f465453c2cc0aed50.tar.gz |
Notice and warn about unterminated quoted strings in commands.
The entire command is ignored if the syntax is invalid...
Diffstat (limited to 'usr.sbin/ppp/chat.c')
-rw-r--r-- | usr.sbin/ppp/chat.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/usr.sbin/ppp/chat.c b/usr.sbin/ppp/chat.c index 0ccda30..ce7899e 100644 --- a/usr.sbin/ppp/chat.c +++ b/usr.sbin/ppp/chat.c @@ -550,7 +550,7 @@ chat_Init(struct chat *c, struct physical *p) memset(&c->timeout, '\0', sizeof c->timeout); } -void +int chat_Setup(struct chat *c, const char *data, const char *phone) { c->state = CHAT_EXPECT; @@ -561,7 +561,7 @@ chat_Setup(struct chat *c, const char *data, const char *phone) } else { strncpy(c->script, data, sizeof c->script - 1); c->script[sizeof c->script - 1] = '\0'; - c->argc = MakeArgs(c->script, c->argv, VECSIZE(c->argv)); + c->argc = MakeArgs(c->script, c->argv, VECSIZE(c->argv)); } c->arg = -1; @@ -575,6 +575,8 @@ chat_Setup(struct chat *c, const char *data, const char *phone) timer_Stop(&c->pause); timer_Stop(&c->timeout); + + return c->argc >= 0; } void @@ -700,7 +702,12 @@ ExecStr(struct physical *physical, char *command, char *out, int olen) int stat, nb, argc, i; log_Printf(LogCHAT, "Exec: %s\n", command); - argc = MakeArgs(command, vector, VECSIZE(vector)); + if ((argc = MakeArgs(command, vector, VECSIZE(vector))) <= 0) { + if (argc < 0) + log_Printf(LogWARN, "Syntax error in exec command\n"); + *out = '\0'; + return; + } command_Expand(argv, argc, (char const *const *)vector, physical->dl->bundle, 0, getpid()); |