summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2015-04-13 19:55:25 -0400
committerPeter Jones <pjones@redhat.com>2015-04-13 19:55:25 -0400
commit0ea5b3e3b7a905aac7668029348d895509de20e6 (patch)
tree7a4b7ca34f4611cc75624f2d0dbb65f6cf590808
parentcb7dec11f2e4dc37d133af8eb9403ef11c28be15 (diff)
downloadefi-boot-shim-0ea5b3e3b7a905aac7668029348d895509de20e6.tar.gz
efi-boot-shim-0ea5b3e3b7a905aac7668029348d895509de20e6.zip
Fix length of allocated buffer for boot option comparison.
The following commit: commit 4aac8a1179e160397d7ef8f1e3232cfb4f3373d6 Author: Gary Ching-Pang Lin <glin@suse.com> Date: Thu Mar 6 10:57:02 2014 +0800 [fallback] Fix the data size for boot option comparison corrected the data size used for comparison, but also reduced the allocation so it doesn't include the trailing UTF16LE '\0\0' at the end of the string, with the result that the trailer of the buffer containing the string is overwritten, which OVMF detects as memory corruption. Increase the size of the storage buffer in a few places to correct this problem. Signed-off-by: Richard W.M. Jones <rjones@redhat.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Gary Ching-Pang Lin <glin@suse.com>
-rw-r--r--fallback.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fallback.c b/fallback.c
index e739b78b..8489b2e8 100644
--- a/fallback.c
+++ b/fallback.c
@@ -163,7 +163,7 @@ add_boot_option(EFI_DEVICE_PATH *hddp, EFI_DEVICE_PATH *fulldp,
StrLen(label)*2 + 2 + DevicePathSize(hddp) +
StrLen(arguments) * 2;
- CHAR8 *data = AllocateZeroPool(size);
+ CHAR8 *data = AllocateZeroPool(size + 2);
CHAR8 *cursor = data;
*(UINT32 *)cursor = LOAD_OPTION_ACTIVE;
cursor += sizeof (UINT32);
@@ -234,7 +234,7 @@ find_boot_option(EFI_DEVICE_PATH *dp, EFI_DEVICE_PATH *fulldp,
StrLen(label)*2 + 2 + DevicePathSize(dp) +
StrLen(arguments) * 2;
- CHAR8 *data = AllocateZeroPool(size);
+ CHAR8 *data = AllocateZeroPool(size + 2);
if (!data)
return EFI_OUT_OF_RESOURCES;
CHAR8 *cursor = data;