From c598688f8987a9cf28937e89bf60466d8daa605c Mon Sep 17 00:00:00 2001 From: David Garske Date: Tue, 17 Aug 2021 10:38:27 -0700 Subject: [PATCH] Fix for static memory with bucket size matching. --- wolfcrypt/src/memory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/memory.c b/wolfcrypt/src/memory.c index c01a8c86e..be1183e99 100644 --- a/wolfcrypt/src/memory.c +++ b/wolfcrypt/src/memory.c @@ -670,7 +670,7 @@ void* wolfSSL_Malloc(size_t size, void* heap, int type) /* general static memory */ if (pt == NULL) { for (i = 0; i < WOLFMEM_MAX_BUCKETS; i++) { - if ((word32)size < mem->sizeList[i]) { + if ((word32)size <= mem->sizeList[i]) { if (mem->ava[i] != NULL) { pt = mem->ava[i]; mem->ava[i] = pt->next; @@ -905,7 +905,7 @@ void* wolfSSL_Realloc(void *ptr, size_t size, void* heap, int type) else { /* general memory */ for (i = 0; i < WOLFMEM_MAX_BUCKETS; i++) { - if ((word32)size < mem->sizeList[i]) { + if ((word32)size <= mem->sizeList[i]) { if (mem->ava[i] != NULL) { pt = mem->ava[i]; mem->ava[i] = pt->next;