From ff8a589019202a5bd52f9defad493eeb6c4de8ef Mon Sep 17 00:00:00 2001 From: Stefano D'Angelo Date: Tue, 26 Mar 2024 21:51:15 +0100 Subject: [PATCH] fix calloc --- templates/web/src/walloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/web/src/walloc.c b/templates/web/src/walloc.c index 4da47a7..da5731f 100644 --- a/templates/web/src/walloc.c +++ b/templates/web/src/walloc.c @@ -127,7 +127,7 @@ void *realloc(void *ptr, size_t size) { } void *calloc(size_t nmemb, size_t size) { - if (nmemb == 0 || SIZE_MAX / nmemb > size || (SIZE_MAX / nmemb == size && SIZE_MAX % nmemb != 0)) + if (nmemb == 0 || SIZE_MAX / nmemb < size || (SIZE_MAX / nmemb == size && SIZE_MAX % nmemb != 0)) return NULL; size_t s = nmemb * size; void *m = malloc(s);