From: Shawn Routhier Date: Wed, 29 Dec 2010 23:01:42 +0000 (+0000) Subject: When processing the format flags for a given option consume the X-Git-Tag: v4_2_1b1~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e49e6374d8526104e63bf5f3e4ffbbfd82c28bfd;p=thirdparty%2Fdhcp.git 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] --- diff --git a/RELNOTES b/RELNOTES index e93ef210c..acecb5576 100644 --- a/RELNOTES +++ b/RELNOTES @@ -159,6 +159,12 @@ work on other platforms. Please report any problems and suggested fixes to Thanks to a report from Jiri Popelka at Red Hat. [ISC-Bugs #22033], [Red Hat Bug #628258] +- 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] + Changes since 4.2.0rc1 - Documentation cleanup covering multiple tickets diff --git a/common/parse.c b/common/parse.c index f459d239c..40e95297a 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;