Skip to content

Commit

Permalink
UefiPayloadPkg/UefiPayloadEntry: Fix memory corruption
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mhaeuser authored and mergify[bot] committed Sep 1, 2021
1 parent 5d34cc4 commit cdda3f7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion UefiPayloadPkg/UefiPayloadEntry/MemoryAllocation.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit cdda3f7

Please sign in to comment.