From 32476340c5fd3c76b86487a92fd5c5075342ca99 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Mon, 4 Dec 2017 16:09:50 +0100 Subject: Fix the configuration parser wrt. non-matching brackets This validation step is a bit idiotic, but we'll replace it with a proper parser anyway. --- src/sp_config_utils.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/sp_config_utils.c') diff --git a/src/sp_config_utils.c b/src/sp_config_utils.c index 71dd373..1a797e5 100644 --- a/src/sp_config_utils.c +++ b/src/sp_config_utils.c @@ -20,7 +20,12 @@ static int validate_str(const char *value) { return -1; } } - return balance != 0; + if (balance != 0) { + sp_log_err("config", "You forgot to close %d bracket%c in the string '%s'", + balance, (balance>1)?'s':' ', value); + return -1; + } + return 0; } int parse_keywords(sp_config_functions *funcs, char *line) { @@ -112,7 +117,7 @@ err: sp_log_err("error", "There is an issue with the parsing of '%s': it doesn't look like a valid string on line %zu.", original_line ? original_line : "NULL", sp_line_no); -} + } line = NULL; return NULL; } -- cgit v1.3