]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Fix pathological parsing loop in add statement. Set expression opcode after parse_cshl.
authorTed Lemon <source@isc.org>
Fri, 6 Nov 1998 02:42:48 +0000 (02:42 +0000)
committerTed Lemon <source@isc.org>
Fri, 6 Nov 1998 02:42:48 +0000 (02:42 +0000)
common/parse.c

index 73e1aed668c979e36f9764f628f7bbb9bf872d9f..38f4286090cf621a3dad1061388e761095f8c073 100644 (file)
@@ -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
@@ -893,6 +893,7 @@ struct executable_statement *parse_executable_statement (cfile, lose)
                stmt = parse_if_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.");
@@ -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,