From e53acb997a14b3985b43365b7c1eeae1656b4f68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20S=C5=82omi=C5=84ski?= Date: Mon, 11 Sep 2023 13:20:17 +0200 Subject: [PATCH] protos: chainload: Allocate memory for the null terminator in cmdline --- common/protos/chainload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/protos/chainload.c b/common/protos/chainload.c index aa47ef99..f0d529a0 100644 --- a/common/protos/chainload.c +++ b/common/protos/chainload.c @@ -242,7 +242,7 @@ noreturn void efi_chainload_file(char *config, char *cmdline, struct file_handle size_t cmdline_len = strlen(cmdline); CHAR16 *new_cmdline; - status = gBS->AllocatePool(EfiLoaderData, cmdline_len * sizeof(CHAR16), (void **)&new_cmdline); + status = gBS->AllocatePool(EfiLoaderData, (cmdline_len + 1) * sizeof(CHAR16), (void **)&new_cmdline); if (status) { panic(true, "chainload: Allocation failure"); }