From: Godbach Date: Wed, 11 Dec 2013 13:11:41 +0000 (+0800) Subject: BUG/MINOR: check_config_validity: check the returned value of stktable_init() X-Git-Tag: v1.5-dev20~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9703e66bceb67baf8ebf53430b0d2c85d26e6b86;p=thirdparty%2Fhaproxy.git BUG/MINOR: check_config_validity: check the returned value of stktable_init() The function stktable_init() will return 0 if create_pool() returns NULL. Since the returned value of this function is ignored, HAProxy will crash if the pool of stick table is NULL and stksess_new() is called to allocate a new stick session. It is a better choice to check the returned value and make HAProxy exit with alert message if any error is caught. Signed-off-by: Godbach --- diff --git a/src/cfgparse.c b/src/cfgparse.c index b05bfe93a3..f9e51913f1 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -7535,8 +7535,12 @@ out_uri_auth_compat: * be done earlier because the data size may be discovered while parsing * other proxies. */ - for (curproxy = proxy; curproxy; curproxy = curproxy->next) - stktable_init(&curproxy->table); + for (curproxy = proxy; curproxy; curproxy = curproxy->next) { + if (!stktable_init(&curproxy->table)) { + Alert("Proxy '%s': failed to initialize stick-table.\n", curproxy->id); + cfgerr++; + } + } /* * Recount currently required checks.