]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: config/dns: properly fail on duplicate nameserver name detection
authorWilly Tarreau <w@1wt.eu>
Thu, 14 May 2026 23:01:36 +0000 (23:01 +0000)
committerWilly Tarreau <w@1wt.eu>
Fri, 15 May 2026 13:04:00 +0000 (15:04 +0200)
In cfg_parse_resolvers(), two duplicate name checks set err_code but lacked
'goto out', allowing execution to fall through and create the duplicate entry.
This would result in new resolvers and nameservers to be created after the
error was displayed, and a leak of the previous one. It's mostly harmless
since we're exiting after such errors. This can be backported if desired.

src/resolvers.c

index 0200be4c5e122092eb302b30fb683666bec133cc..6556cc8a52e5e1928b5e2fe07b724b67592ffd4c 100644 (file)
@@ -3712,6 +3712,7 @@ int cfg_parse_resolvers(const char *file, int linenum, char **args, int kwm)
                                ha_alert("Parsing [%s:%d]: resolvers '%s' has same name as another resolvers (declared at %s:%d).\n",
                                         file, linenum, args[1], curr_resolvers->conf.file, curr_resolvers->conf.line);
                                err_code |= ERR_ALERT | ERR_ABORT;
+                               goto out;
                        }
                }
 
@@ -3749,6 +3750,7 @@ int cfg_parse_resolvers(const char *file, int linenum, char **args, int kwm)
                                ha_alert("Parsing [%s:%d]: nameserver '%s' has same name as another nameserver (declared at %s:%d).\n",
                                         file, linenum, args[1], newnameserver->conf.file, newnameserver->conf.line);
                                err_code |= ERR_ALERT | ERR_FATAL;
+                               goto out;
                        }
                }