summaryrefslogtreecommitdiff
path: root/ArmPlatformPkg/Bds
diff options
context:
space:
mode:
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2012-05-02 20:17:36 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2012-05-02 20:17:36 +0000
commit14238a61c8c17668c705c46c38cf8d7186880bfa (patch)
tree6d3ee03c6fb50df7dbc875212232a5e9407aecb9 /ArmPlatformPkg/Bds
parent1c8f9a70d0176915b8d930740f5a57a51049fb5a (diff)
downloadedk2-platforms-14238a61c8c17668c705c46c38cf8d7186880bfa.tar.xz
ArmPlatformPkg/Bds: Fixed Memory Corruption when updating the path of a Linux initrd
Signed-off-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13264 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPlatformPkg/Bds')
-rw-r--r--ArmPlatformPkg/Bds/BootMenu.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c
index e7e475dfc1..ecd1d60f40 100644
--- a/ArmPlatformPkg/Bds/BootMenu.c
+++ b/ArmPlatformPkg/Bds/BootMenu.c
@@ -354,7 +354,8 @@ BootMenuUpdateBootOption (
ARM_BDS_LOADER_ARGUMENTS* BootArguments;
CHAR16 BootDescription[BOOT_DEVICE_DESCRIPTION_MAX];
CHAR8 CmdLine[BOOT_DEVICE_OPTION_MAX];
- EFI_DEVICE_PATH* DevicePath;
+ EFI_DEVICE_PATH *DevicePath;
+ EFI_DEVICE_PATH *TempInitrdPath;
ARM_BDS_LOADER_TYPE BootType;
ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData;
ARM_BDS_LINUX_ARGUMENTS* LinuxArguments;
@@ -423,11 +424,13 @@ BootMenuUpdateBootOption (
if (InitrdPathNode != NULL) {
// Duplicate Linux kernel Device Path
- DevicePath = DuplicateDevicePath (BootOption->FilePathList);
+ TempInitrdPath = DuplicateDevicePath (BootOption->FilePathList);
// Replace Linux kernel Node by EndNode
- SetDevicePathEndNode (GetLastDevicePathNode (DevicePath));
+ SetDevicePathEndNode (GetLastDevicePathNode (TempInitrdPath));
// Append the Device Path node to the select device path
- InitrdPath = AppendDevicePathNode (DevicePath, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNode);
+ InitrdPath = AppendDevicePathNode (TempInitrdPath, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNode);
+ FreePool (TempInitrdPath);
+ InitrdSize = GetDevicePathSize (InitrdPath);
} else {
InitrdPath = NULL;
}