packages/net/haproxy/patches/0034-BUG-MINOR-cache-Wrong-usage-of-shctx_init.patch
Christian Lachner ca39a1b787 haproxy: Update all patches for HAProxy v1.8.14
- Add new patches (see https://www.haproxy.org/bugs/bugs-1.8.14.html)
- Raise PKG_RELEASE to 4

Signed-off-by: Christian Lachner <gladiac@gmail.com>
2018-11-02 10:35:38 +01:00

28 lines
980 B
Diff

commit 68c23dedaaae8f29d26c4791b30d138ed1411548
Author: Frédéric Lécaille <flecaille@haproxy.com>
Date: Thu Oct 25 20:18:59 2018 +0200
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.
(cherry picked from commit bc584494e625983f16f35982aa6dd6889e8dd222)
Signed-off-by: Willy Tarreau <w@1wt.eu>
diff --git a/src/cache.c b/src/cache.c
index df3649ea..667cede3 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -837,7 +837,7 @@ int cfg_post_parse_section_cache()
ret_shctx = shctx_init(&shctx, tmp_cache_config->maxblocks, CACHE_BLOCKSIZE, 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