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.
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 88231f9..a24eda8 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -1543,7 +1543,7 @@
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 @@
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;
}