From c786768dbaa178a2b9ad82eebf004eb3e541201d Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 27 Jul 2018 10:26:22 +0200 Subject: [PATCH] BUG/MINOR: config: stick-table is not supported in defaults section Thierry discovered that the following config crashes haproxy while parsing the config (it's probably the smallest crasher) : defaults stick-table type ip size 1M And indeed it does because it looks for the current proxy's name which it does not have as it's the default one. This affects all versions since 1.6. This fix must be backported to all versions back to 1.6. --- src/cfgparse.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/cfgparse.c b/src/cfgparse.c index b44e6fa88..9841e2dc6 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -4117,6 +4117,13 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) int myidx = 1; struct proxy *other; + if (curproxy == &defproxy) { + ha_alert("parsing [%s:%d] : 'stick-table' is not supported in 'defaults' section.\n", + file, linenum); + err_code |= ERR_ALERT | ERR_FATAL; + goto out; + } + other = proxy_tbl_by_name(curproxy->id); if (other) { ha_alert("parsing [%s:%d] : stick-table name '%s' conflicts with table declared in %s '%s' at %s:%d.\n",