summaryrefslogtreecommitdiffstats
path: root/UefiPayloadPkg
diff options
context:
space:
mode:
authorMarvin H?user <mhaeuser@posteo.de>2021-08-09 03:39:53 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-09-01 04:13:50 +0000
commitcdda3f74a1327663a5d48cca13507085ba403af7 (patch)
treed6e558fcc982fb0fa49b05ac51acfe67e2fb19f9 /UefiPayloadPkg
parent5d34cc49d5d348012fe8acf9fb618826bd541a7c (diff)
downloadedk2-cdda3f74a1327663a5d48cca13507085ba403af7.tar.gz
edk2-cdda3f74a1327663a5d48cca13507085ba403af7.tar.bz2
edk2-cdda3f74a1327663a5d48cca13507085ba403af7.zip
UefiPayloadPkg/UefiPayloadEntry: Fix memory corruption
UefiPayloadEntry's AllocatePool() applies the "sizeof" operator to HOB index rather than the HOB header structure. This yields 4 Bytes compared to the 8 Bytes the structure header requires. Fix the call to allocate the required space instead. Reviewed-by: Guo Dong <guo.dong@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: Maurice Ma <maurice.ma@intel.com> Cc: Benjamin You <benjamin.you@intel.com> Cc: Vitaly Cheptsov <vit9696@protonmail.com> Signed-off-by: Marvin H?user <mhaeuser@posteo.de>
Diffstat (limited to 'UefiPayloadPkg')
-rw-r--r--UefiPayloadPkg/UefiPayloadEntry/MemoryAllocation.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/UefiPayloadPkg/UefiPayloadEntry/MemoryAllocation.c b/UefiPayloadPkg/UefiPayloadEntry/MemoryAllocation.c
index 1204573b3e..f3494969e5 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/MemoryAllocation.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/MemoryAllocation.c
@@ -163,7 +163,7 @@ AllocatePool (
return NULL;
}
- Hob = (EFI_HOB_MEMORY_POOL *)CreateHob (EFI_HOB_TYPE_MEMORY_POOL, (UINT16)(sizeof (EFI_HOB_TYPE_MEMORY_POOL) + AllocationSize));
+ Hob = (EFI_HOB_MEMORY_POOL *)CreateHob (EFI_HOB_TYPE_MEMORY_POOL, (UINT16)(sizeof (EFI_HOB_MEMORY_POOL) + AllocationSize));
return (VOID *)(Hob + 1);
}