From c5b12e43686caaf3d5ad33a7aeee0265fe4d6527 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Wed, 1 Feb 2012 22:15:43 +0100 Subject: [PATCH] getdata: fix configuration parser bug When { is wrote together with a word, such as pool{ range 10.0.0.100 100.0.0.200; range .. the parser ignored first range, resulting it to disappear from analysis. Reported-by: Robert Viou Signed-off-by: Sami Kerola --- THANKS | 1 + src/getdata.c | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/THANKS b/THANKS index 939f7e8..55c81f5 100644 --- a/THANKS +++ b/THANKS @@ -20,3 +20,4 @@ Thor Eivind Brantzeg Ahmed AL Dakhil Adam Ciarcinski Rezso Gajdóczy +Robert Viou diff --git a/src/getdata.c b/src/getdata.c index c4b92b7..4f8adbe 100644 --- a/src/getdata.c +++ b/src/getdata.c @@ -332,8 +332,10 @@ void parse_config(int is_include, const char *restrict config_file, * shared-network DSL{ ... */ if (i == 0) { newclause = true; + continue; + } else { + break; } - continue; case '}': if (quote == true) { break; @@ -383,9 +385,10 @@ void parse_config(int is_include, const char *restrict config_file, else if (newclause == true) { /* Insert string end & set state */ word[i] = '\0'; - newclause = false; + if (word[i - 1] != '{') { + newclause = false; + } i = 0; - argument = is_interesting_config_clause(word); } /* words after range, shared-network or include */