summaryrefslogtreecommitdiffstats
path: root/MdePkg
diff options
context:
space:
mode:
authorDoug Flick <dougflick@microsoft.com>2024-09-30 12:54:30 -0700
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-10-02 19:45:12 +0000
commite73ec569429ba72fbb6829518d6c192b4cd3346f (patch)
treed9f2cc18f58e25b6086e7e5cfcbae7b89712f89e /MdePkg
parentcac73c45c4a9eaf81613260fb52bfc990e59bc0d (diff)
downloadedk2-e73ec569429ba72fbb6829518d6c192b4cd3346f.tar.gz
edk2-e73ec569429ba72fbb6829518d6c192b4cd3346f.tar.bz2
edk2-e73ec569429ba72fbb6829518d6c192b4cd3346f.zip
MdePkg: Improving readability of CVE patch for PeCoffLoaderRelocateImage
This change adds parantheses to the if condition detecting overflow in the PeCoffLoaderRelocateImage function to improve readability. Follow on change for: REF!: https://github.com/tianocore/edk2/pull/6249 Signed-off-by: Doug Flick <dougflick@microsoft.com>
Diffstat (limited to 'MdePkg')
-rw-r--r--MdePkg/Library/BasePeCoffLib/BasePeCoff.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c
index 128090d98e..617e86dfda 100644
--- a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c
+++ b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c
@@ -1054,7 +1054,7 @@ PeCoffLoaderRelocateImage (
RelocDir = &Hdr.Te->DataDirectory[0];
}
- if ((RelocDir != NULL) && (RelocDir->Size > 0) && (RelocDir->Size - 1 < MAX_UINT32 - RelocDir->VirtualAddress)) {
+ if ((RelocDir != NULL) && (RelocDir->Size > 0) && ((RelocDir->Size - 1) < (MAX_UINT32 - RelocDir->VirtualAddress))) {
RelocBase = (EFI_IMAGE_BASE_RELOCATION *)PeCoffLoaderImageAddress (ImageContext, RelocDir->VirtualAddress, TeStrippedOffset);
RelocBaseEnd = (EFI_IMAGE_BASE_RELOCATION *)PeCoffLoaderImageAddress (
ImageContext,