BUG/MAJOR: checks: always check for end of list before proceeding
authorWilly Tarreau <w@1wt.eu>
Wed, 13 May 2015 10:08:21 +0000 (12:08 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 13 May 2015 13:31:34 +0000 (15:31 +0200)
commitf2c87353a7f8160930b5f342bb6d6ad0991ee3d1
treefeccfc49a0971069d0b53582b8e12695437f03e1
parent263013d031d754c9f96de0d0cb5afcc011af6441
BUG/MAJOR: checks: always check for end of list before proceeding

This is the most important fix of this series. There's a risk of endless
loop and crashes caused by the fact that we go past the head of the list
when skipping to next rule, without checking if it's still a valid element.
Most of the time, the ->action field is checked, which points to the proxy's
check_req pointer (generally NULL), meaning the element is confused with a
TCPCHK_ACT_SEND action.

The situation was accidently made worse with the addition of tcp-check
comment since it also skips list elements. However, since the action that
makes it go forward is TCPCHK_ACT_COMMENT (3), there's little chance to
see this as a valid pointer, except on 64-bit machines where it can match
the end of a check_req string pointer.

This fix heavily depends on previous cleanup and both must be backported
to 1.5 where the bug is present.
src/cfgparse.c
src/checks.c