summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi, Walon <walon.li@hpe.com>2021-05-13 10:48:40 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-05-21 08:31:39 +0000
commit1fb80369b72c6ba7f80b442e4acf771a6dd56ee7 (patch)
treeff0c00315cc522fc062219bd63b47b2375b74737
parent04ae17218deec25c6f488609c5e2ca9c419d2c4b (diff)
downloadedk2-1fb80369b72c6ba7f80b442e4acf771a6dd56ee7.zip
edk2-1fb80369b72c6ba7f80b442e4acf771a6dd56ee7.tar.gz
edk2-1fb80369b72c6ba7f80b442e4acf771a6dd56ee7.tar.bz2
MdeModulePkg/PlatformDriOverrideDxe: Fix overflow condition check
Code mistake, VariableIndex is smaller normally than buffer+buffersize so should not break loop. Signed-off-by: Walon Li <walon.li@hpe.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
-rw-r--r--MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideLib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideLib.c b/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideLib.c
index f91f038..bd2d044 100644
--- a/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideLib.c
+++ b/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideLib.c
@@ -776,7 +776,7 @@ InitOverridesMapping (
// Check buffer overflow
//
if ((DriverImageInfo->DriverImagePath == NULL) || (VariableIndex < (UINT8 *) DriverDevicePath) ||
- (VariableIndex < (UINT8 *) VariableBuffer + BufferSize)) {
+ (VariableIndex > (UINT8 *) VariableBuffer + BufferSize)) {
Corrupted = TRUE;
break;
}