BUG/MEDIUM: config: immediately abort if peers section has no name

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.
This commit is contained in:
Willy Tarreau 2014-02-16 08:20:13 +01:00
parent 9a60ff9cb6
commit 5498472ec0

View 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;
}