]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: init: address another coverity warning about a possible multiply overflow
authorWilly Tarreau <w@1wt.eu>
Thu, 26 May 2022 06:55:05 +0000 (08:55 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 26 May 2022 06:55:05 +0000 (08:55 +0200)
Commit 2cb3be76b ("CLEANUP: init: address a coverity warning about
possible multiply overflow") was incomplete, two other locations were
present. This should address issue #1585.

src/haproxy.c

index 130bc9b35487521b59e8b41dc874201b0d070478..203897b73740ab7f3ba533110fe1e1020372364c 100644 (file)
@@ -2347,7 +2347,7 @@ static void init(int argc, char **argv)
                int64_t mem = global.rlimit_memmax * 1048576ULL;
                int64_t sslmem;
 
-               mem -= global.tune.sslcachesize * 200; // about 200 bytes per SSL cache entry
+               mem -= global.tune.sslcachesize * 200ULL; // about 200 bytes per SSL cache entry
                mem -= global.maxzlibmem;
                mem = mem * MEM_USABLE_RATIO;
 
@@ -2380,7 +2380,7 @@ static void init(int argc, char **argv)
                int retried = 0;
 
                if (global.ssl_used_frontend || global.ssl_used_backend)
-                       mem -= global.tune.sslcachesize * 200; // about 200 bytes per SSL cache entry
+                       mem -= global.tune.sslcachesize * 200ULL; // about 200 bytes per SSL cache entry
 
                mem -= global.maxzlibmem;
                mem = mem * MEM_USABLE_RATIO;