diff options
author | Shawn Routhier <sar@isc.org> | 2010-12-29 22:56:01 +0000 |
---|---|---|
committer | Shawn Routhier <sar@isc.org> | 2010-12-29 22:56:01 +0000 |
commit | e1a402115d2522187ef1706b4735cc00de5c3b28 (patch) | |
tree | d7f6503c8b7edfff415ddb789ac86152ea03af79 /common/parse.c | |
parent | 9043399dc37f81fae4c32f04442b2b1a5878cdcc (diff) | |
download | isc-dhcp-e1a402115d2522187ef1706b4735cc00de5c3b28.tar.gz |
When processing the format flags for a given option consume the
flag indicating an optional value correctly. A symptom of this
bug was an infinite loop when trying to parse the slp-service-scope
option. Thanks to a patch from Marius Tomaschewski.
[ISC-Bugs #22055]
Diffstat (limited to 'common/parse.c')
-rw-r--r-- | common/parse.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/common/parse.c b/common/parse.c index f459d239..40e95297 100644 --- a/common/parse.c +++ b/common/parse.c @@ -4977,8 +4977,28 @@ struct option *option; do { if ((*fmt == 'A') || (*fmt == 'a')) break; - if (*fmt == 'o') + if (*fmt == 'o') { + /* consume the optional flag */ + fmt++; continue; + } + + if (fmt[1] == 'o') { + /* + * A value for the current format is + * optional - check to see if the next + * token is a semi-colon if so we don't + * need to parse it and doing so would + * consume the semi-colon which our + * caller is expecting to parse + */ + token = peek_token(&val, (unsigned *)0, + cfile); + if (token == SEMI) { + fmt++; + continue; + } + } tmp = *expr; *expr = NULL; |