From 4b50d06b15672b5e7363542d351b8f5214921061 Mon Sep 17 00:00:00 2001 From: bzt Date: Mon, 1 Nov 2021 22:35:45 +0100 Subject: [PATCH] Fixed pool size --- uefi/stdlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uefi/stdlib.c b/uefi/stdlib.c index efd706d..1b43f21 100644 --- a/uefi/stdlib.c +++ b/uefi/stdlib.c @@ -84,7 +84,7 @@ void *malloc (size_t __size) * too, because realloc won't work otherwise... Why can't AllocatePool accept input addresses? */ for(i = 0; i < __stdlib_numallocs && __stdlib_allocs[i] != 0; i += 2); if(i == __stdlib_numallocs) { - status = BS->AllocatePool(LIP ? LIP->ImageDataType : EfiLoaderData, __stdlib_numallocs + 2, &ret); + status = BS->AllocatePool(LIP ? LIP->ImageDataType : EfiLoaderData, (__stdlib_numallocs + 2) * sizeof(uintptr_t), &ret); if(EFI_ERROR(status) || !ret) { errno = ENOMEM; return NULL; } if(__stdlib_allocs) memcpy(ret, __stdlib_allocs, __stdlib_numallocs * sizeof(uintptr_t)); __stdlib_allocs = (uintptr_t*)ret;