]> git.ipfire.org Git - thirdparty/haproxy.git/commit
[BUG] check: http-check expect + regex would crash in defaults section
authorWilly Tarreau <w@1wt.eu>
Fri, 19 Aug 2011 18:04:17 +0000 (20:04 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 19 Aug 2011 18:14:01 +0000 (20:14 +0200)
commit1ee51a658186b354bd1713f8102ca9bd446105db
treedbc7c4cbe6b7d35c3382e1cfaeec042f09ac3749
parent8effd3de5b7020473dc7ea208225f26c271aeee3
[BUG] check: http-check expect + regex would crash in defaults section

Manoj Kumar reported a case where haproxy would crash upon start-up. The
cause was an "http-check expect" statement declared in the defaults section,
which caused a NULL regex to be used during the check. This statement is not
allowed in defaults sections precisely because this requires saving a copy
of the regex in the default proxy. But the check was not made to prevent it
from being declared there, hence the issue.

Instead of adding code to detect its abnormal use, we decided to implement
it. It was not that much complex because the expect_str part was not used
with regexes, so it could hold the string form of the regex in order to
compile it again for every backend (there's no way to clone regexes).

This patch has been tested and works. So it's both a bugfix and a minor
feature enhancement.

It should be backported to 1.4 though it's not critical since the config
was not supposed to be supported.
doc/configuration.txt
include/types/proxy.h
src/cfgparse.c