From a313b5240a477e0d04294ffd170408d954181daa Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 19 Aug 2021 09:11:38 -0400 Subject: [PATCH] dhclient: skip_to_semi() consumes semicolon already When invalid statement is found the next statement is skipped even if it is valid. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31527 --- sbin/dhclient/clparse.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c index 58ece525f8d1..c7b02a073aa3 100644 --- a/sbin/dhclient/clparse.c +++ b/sbin/dhclient/clparse.c @@ -199,7 +199,6 @@ void parse_client_statement(FILE *cfile, struct interface_info *ip, struct client_config *config) { - int token; char *val; struct option *option; time_t tmp; @@ -290,15 +289,11 @@ parse_client_statement(FILE *cfile, struct interface_info *ip, parse_reject_statement(cfile, config); return; default: - parse_warn("expecting a statement."); - skip_to_semi(cfile); break; } - token = next_token(&val, cfile); - if (token != SEMI) { - parse_warn("semicolon expected."); - skip_to_semi(cfile); - } + + parse_warn("expecting a statement."); + skip_to_semi(cfile); } unsigned @@ -637,7 +632,7 @@ parse_client_lease_declaration(FILE *cfile, struct client_lease *lease, if (token != STRING) { parse_warn("expecting interface name (in quotes)."); skip_to_semi(cfile); - break; + return; } ip = interface_or_dummy(val); *ipp = ip; @@ -674,7 +669,7 @@ parse_client_lease_declaration(FILE *cfile, struct client_lease *lease, default: parse_warn("expecting lease declaration."); skip_to_semi(cfile); - break; + return; } token = next_token(&val, cfile); if (token != SEMI) {