From a9d9c9ece2eb966537c2e3302b06896cea74bdea Mon Sep 17 00:00:00 2001 From: Pierre Olivier Date: Tue, 20 Apr 2021 09:09:07 +0100 Subject: [PATCH] fix bug when round_sz() rounds to 0 --- src/slimguard.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/slimguard.c b/src/slimguard.c index 1109bcd..b781b1f 100644 --- a/src/slimguard.c +++ b/src/slimguard.c @@ -371,6 +371,10 @@ void* xxmalloc(size_t sz) { uint8_t index = 255; need = round_sz(sz); + /* Can happen if sz is large enough */ + if(!need) + return NULL; + if (need >= (1 << 17)) { Debug("sz %lu\n", need); ret = xxmalloc_large(need, 0);