Make a copy of modules list, because RtlTokenizeWideString() modifies input data
This commit is contained in:
parent
03ffa1d901
commit
a65c22c9c9
@ -113,10 +113,10 @@ BlInvokeBootProtocol(IN PLIST_ENTRY OptionsList)
|
|||||||
PWCHAR ModulesList, ProtocolName;
|
PWCHAR ModulesList, ProtocolName;
|
||||||
PLIST_ENTRY OptionsListEntry;
|
PLIST_ENTRY OptionsListEntry;
|
||||||
PXTBL_CONFIG_ENTRY Option;
|
PXTBL_CONFIG_ENTRY Option;
|
||||||
|
SIZE_T ModuleListLength;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
/* Set default values */
|
/* Set default values */
|
||||||
ModulesList = NULL;
|
|
||||||
ProtocolName = NULL;
|
ProtocolName = NULL;
|
||||||
|
|
||||||
/* Iterate through all options provided by boot menu entry */
|
/* 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)
|
else if(RtlCompareWideStringInsensitive(Option->Name, L"BOOTMODULES", 0) == 0)
|
||||||
{
|
{
|
||||||
/* Set protocol name */
|
/* Check a length of modules list */
|
||||||
ModulesList = Option->Value;
|
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 */
|
/* Move to the next option entry */
|
||||||
|
Loading…
Reference in New Issue
Block a user