]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: config: avoid skipping disabled proxies
authorWilly Tarreau <w@1wt.eu>
Fri, 10 Oct 2014 12:54:25 +0000 (14:54 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 10 Oct 2014 12:58:52 +0000 (14:58 +0200)
Paul Taylor and Bryan Talbot found that after commit 419ead8 ("MEDIUM:
config: compute the exact bind-process before listener's maxaccept"),
a backend marked "disabled" would cause the next backend to be skipped
and if it was the last one it would cause a segfault.

The reason is that the commit above changed the "while" loop for a "for"
loop but a "continue" statement still incrementing the current proxy was
left in the code for disabled proxies, causing the next one to be skipped
as well and the last one to try to dereference NULL when seeking ->next.

The quick workaround consists in not disabling backends, or adding an
empty dummy one after a disabled section.

This fix must be backported to 1.5.

src/cfgparse.c

index 72f3d92352ca248ddadc2076aa19f93f67e748b8..09a0fd3d777671be64e0cbadd88d29b980c013d3 100644 (file)
@@ -6157,7 +6157,6 @@ int check_config_validity()
                if (curproxy->state == PR_STSTOPPED) {
                        /* ensure we don't keep listeners uselessly bound */
                        stop_proxy(curproxy);
-                       curproxy = curproxy->next;
                        continue;
                }