]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: config: stick-table is not supported in defaults section
authorWilly Tarreau <w@1wt.eu>
Fri, 27 Jul 2018 08:26:22 +0000 (10:26 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 27 Jul 2018 08:26:22 +0000 (10:26 +0200)
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

index b44e6fa8806e5db85406dcbf7ff3ff641d36b872..9841e2dc6a3f1d38a3e3057700fc8d7b39625780 100644 (file)
@@ -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",