SHA256
1
0
forked from pool/dhcp
dhcp/dhcp-4.1.1-P1-optional-value-infinite-loop.diff

47 lines
1.2 KiB
Diff
Raw Normal View History

From 912eb17103f764ef4486b30a4801af64321a23ed Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski <mt@suse.de>
Date: Fri, 29 Oct 2010 18:51:02 +0200
Subject: [PATCH] dhcp-4.1.1-P1-optional-value-infinite-loop
Fixed dhcp server infinite loop while parsing options with optional
parts in the value such as in slp-service-scope option (bnc#643845,
[ISC-Bugs #22410]).
Signed-off-by: Marius Tomaschewski <mt@suse.de>
---
common/parse.c | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/common/parse.c b/common/parse.c
index 34b909a..081dcc9 100644
--- a/common/parse.c
+++ b/common/parse.c
@@ -4931,8 +4931,23 @@ struct option *option;
do {
if ((*fmt == 'A') || (*fmt == 'a'))
break;
- if (*fmt == 'o')
+ if (*fmt == 'o') {
+ /* previous value were optional */
+ fmt++;
continue;
+ }
+ if (fmt[1] == 'o') {
+ /*
+ * value for current format code is optional
+ * check if the next token is a semicolon;
+ * it is expected to be read by our caller.
+ */
+ token = peek_token (&val, (unsigned *)0, cfile);
+ if (token == SEMI) {
+ fmt++;
+ continue;
+ }
+ }
tmp = *expr;
*expr = NULL;
--
1.7.1