diff options
author | Ted Lemon <source@isc.org> | 1998-11-06 02:42:48 +0000 |
---|---|---|
committer | Ted Lemon <source@isc.org> | 1998-11-06 02:42:48 +0000 |
commit | efc79acbb942c4e72125418b09e1fe0ecccfff5d (patch) | |
tree | ed00706ae28b6ed714d80991bd1e2771aaac8d9a /common | |
parent | d25524bd8df9e2f028d88410b90edaab5c937596 (diff) | |
download | isc-dhcp-efc79acbb942c4e72125418b09e1fe0ecccfff5d.tar.gz |
Fix pathological parsing loop in add statement. Set expression opcode after parse_cshl.
Diffstat (limited to 'common')
-rw-r--r-- | common/parse.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/common/parse.c b/common/parse.c index 73e1aed6..38f42860 100644 --- a/common/parse.c +++ b/common/parse.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: parse.c,v 1.10 1998/11/06 00:30:19 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: parse.c,v 1.11 1998/11/06 02:42:48 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -72,8 +72,8 @@ void skip_to_semi (cfile) do { token = peek_token (&val, cfile); if (token == RBRACE) { + token = next_token (&val, cfile); if (brace_count) { - token = next_token (&val, cfile); if (!--brace_count) return; } else @@ -894,6 +894,7 @@ struct executable_statement *parse_executable_statement (cfile, lose) return stmt; case ADD: token = next_token (&val, cfile); + token = next_token (&val, cfile); if (token != STRING) { parse_warn ("expecting class name."); skip_to_semi (cfile); @@ -1025,9 +1026,14 @@ struct executable_statement *parse_if_statement (cfile, lose) return (struct executable_statement *)0; } true = parse_executable_statements (cfile, lose); - if (*lose) - return (struct executable_statement *)0; token = next_token (&val, cfile); + if (*lose) { + /* Try to even things up. */ + do { + token = next_token (&val, cfile); + } while (token != EOF && token != RBRACE); + return (struct executable_statement *)0; + } if (token != RBRACE) { parse_warn ("right brace expected."); skip_to_semi (cfile); @@ -1737,6 +1743,7 @@ int parse_option_token (rv, cfile, fmt, expr, uniform, lookups) return 0; if (!parse_cshl (&t -> data.const_data, cfile)) return 0; + t -> op = expr_const_data; } else if (token == STRING) { token = next_token (&val, cfile); if (!make_const_data (&t, (unsigned char *) val, |