From: Frédéric Lécaille Date: Thu, 25 Oct 2018 18:18:59 +0000 (+0200) Subject: BUG/MINOR: cache: Wrong usage of shctx_init(). X-Git-Tag: v1.9-dev5~44 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bc584494e625983f16f35982aa6dd6889e8dd222;p=thirdparty%2Fhaproxy.git BUG/MINOR: cache: Wrong usage of shctx_init(). With this patch we check that shctx_init() does not returns 0. This is possible if the maxblocks argument, which is passed as an int, is negative due to an implicit conversion. Must be backported to 1.8. --- diff --git a/src/cache.c b/src/cache.c index 9070e996dc..77986fb9e0 100644 --- a/src/cache.c +++ b/src/cache.c @@ -925,7 +925,7 @@ int cfg_post_parse_section_cache() ret_shctx = shctx_init(&shctx, tmp_cache_config->maxblocks, CACHE_BLOCKSIZE, tmp_cache_config->maxobjsz, sizeof(struct cache), 1); - if (ret_shctx < 0) { + if (ret_shctx <= 0) { if (ret_shctx == SHCTX_E_INIT_LOCK) ha_alert("Unable to initialize the lock for the cache.\n"); else