]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: config: immediately abort if peers section has no name
authorWilly Tarreau <w@1wt.eu>
Sun, 16 Feb 2014 07:20:13 +0000 (08:20 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 16 Feb 2014 07:20:13 +0000 (08:20 +0100)
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

index 88231f9535cab87ee27d8cb633f860cf4122b29b..a24eda8aa66f6d239b285c08aeec2fed69fac8ec 100644 (file)
@@ -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;
                }