]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
When processing the format flags for a given option consume the
authorShawn Routhier <sar@isc.org>
Wed, 29 Dec 2010 22:56:01 +0000 (22:56 +0000)
committerShawn Routhier <sar@isc.org>
Wed, 29 Dec 2010 22:56:01 +0000 (22:56 +0000)
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]

RELNOTES
common/parse.c

index f7edada2b3a456cdf89cb2d23be78f97546202d3..4b8c55c927056b30a2d3d7f8ed9eb7431dc38af5 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -169,6 +169,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.0b2
 
 - Add declaration for variable in debug code in alloc.c.  [ISC-Bugs #21472]
@@ -2718,7 +2724,6 @@ work on other platforms. Please report any problems and suggested fixes to
 - Fix a bug in the DHCP client initial startup backoff interval, which
   would cause two DHCPDISCOVERS to be sent back-to-back on startup.
 
-
                Changes since 3.0 Beta 2 Patchlevel 15
 
 - Some documentation tweaks.
index f459d239c113fd2866e12ef5228b21793414b352..40e95297aca7f111fdd8ea78cf7b9abfafd5923c 100644 (file)
@@ -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;