git: 3bcf919c4e89 - stable/13 - dhclient: skip_to_semi() consumes semicolon already

Mark Johnston markj at FreeBSD.org
Thu Aug 26 11:46:37 UTC 2021


The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=3bcf919c4e891287038150116ee81054a46b0075

commit 3bcf919c4e891287038150116ee81054a46b0075
Author:     Franco Fichtner <franco at opnsense.org>
AuthorDate: 2021-08-19 13:11:38 +0000
Commit:     Mark Johnston <markj at FreeBSD.org>
CommitDate: 2021-08-26 11:46:01 +0000

    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
    
    (cherry picked from commit a313b5240a477e0d04294ffd170408d954181daa)
---
 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) {


More information about the dev-commits-src-all mailing list