Skip to content

Commit 15c43dd

Browse files
FlickdmAmyChan-Intel
authored andcommitted
MdePkg: Improving readability of CVE patch for PeCoffLoaderRelocateImage
(cherry picked from commit e73ec56) This change adds parantheses to the if condition detecting overflow in the PeCoffLoaderRelocateImage function to improve readability. Follow on change for: REF!: tianocore#6249 Signed-off-by: Doug Flick <dougflick@microsoft.com> (cherry picked from commit e73ec56) Change-Id: Ifdeffbfc560731b409ef79f0021e7d9aac319569
1 parent d1ab0db commit 15c43dd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

MdePkg/Library/BasePeCoffLib/BasePeCoff.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,7 @@ PeCoffLoaderRelocateImage (
10541054
RelocDir = &Hdr.Te->DataDirectory[0];
10551055
}
10561056

1057-
if ((RelocDir != NULL) && (RelocDir->Size > 0) && (RelocDir->Size - 1 < MAX_UINT32 - RelocDir->VirtualAddress)) {
1057+
if ((RelocDir != NULL) && (RelocDir->Size > 0) && ((RelocDir->Size - 1) < (MAX_UINT32 - RelocDir->VirtualAddress))) {
10581058
RelocBase = (EFI_IMAGE_BASE_RELOCATION *)PeCoffLoaderImageAddress (ImageContext, RelocDir->VirtualAddress, TeStrippedOffset);
10591059
RelocBaseEnd = (EFI_IMAGE_BASE_RELOCATION *)PeCoffLoaderImageAddress (
10601060
ImageContext,

0 commit comments

Comments
 (0)