From 5498472ec0421eea77992c70d560828a6153df6e Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sun, 16 Feb 2014 08:20:13 +0100 Subject: [PATCH] BUG/MEDIUM: config: immediately abort if peers section has no name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cyril Bonté reported that despite commit 0dbbf317 which attempted to fix the crash when a peers section has no name, we still get a segfault after the error message when parsing the peers. The reason is that the returned error code is ERR_FATAL and not ERR_ABORT, so the parsing continues while the section was not initialized. This is 1.5-specific, no backport is needed. --- src/cfgparse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cfgparse.c b/src/cfgparse.c index 88231f953..a24eda8aa 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -1543,7 +1543,7 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm) if (strcmp(args[0], "peers") == 0) { /* new peers section */ if (!*args[1]) { Alert("parsing [%s:%d] : missing name for peers section.\n", file, linenum); - err_code |= ERR_ALERT | ERR_FATAL; + err_code |= ERR_ALERT | ERR_ABORT; goto out; } @@ -1551,7 +1551,7 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm) if (err) { Alert("parsing [%s:%d] : character '%c' is not permitted in '%s' name '%s'.\n", file, linenum, *err, args[0], args[1]); - err_code |= ERR_ALERT | ERR_FATAL; + err_code |= ERR_ALERT | ERR_ABORT; goto out; }