Make a copy of modules list, because RtlTokenizeWideString() modifies input data
All checks were successful
Builds / ExectOS (amd64) (push) Successful in 29s
Builds / ExectOS (i686) (push) Successful in 29s

This commit is contained in:
Rafal Kupiec 2023-12-30 14:36:37 +01:00
parent 03ffa1d901
commit a65c22c9c9
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4

View File

@ -113,10 +113,10 @@ BlInvokeBootProtocol(IN PLIST_ENTRY OptionsList)
PWCHAR ModulesList, ProtocolName;
PLIST_ENTRY OptionsListEntry;
PXTBL_CONFIG_ENTRY Option;
SIZE_T ModuleListLength;
EFI_STATUS Status;
/* Set default values */
ModulesList = NULL;
ProtocolName = NULL;
/* Iterate through all options provided by boot menu entry */
@ -134,8 +134,19 @@ BlInvokeBootProtocol(IN PLIST_ENTRY OptionsList)
}
else if(RtlCompareWideStringInsensitive(Option->Name, L"BOOTMODULES", 0) == 0)
{
/* Set protocol name */
ModulesList = Option->Value;
/* Check a length of modules list */
ModuleListLength = RtlWideStringLength(Option->Value, 0);
Status = BlMemoryAllocatePool(sizeof(PWCHAR) * ModuleListLength, (PVOID *)&ModulesList);
if(Status != STATUS_EFI_SUCCESS)
{
/* Failed to allocate memory, print error message and return status code */
BlDebugPrint(L"ERROR: Memory allocation failure (Status Code: 0x%lx)\n");
return STATUS_EFI_OUT_OF_RESOURCES;
}
/* Make a copy of modules list */
RtlCopyMemory(ModulesList, Option->Value, sizeof(PWCHAR) * ModuleListLength);
}
/* Move to the next option entry */