public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Li, Walon" <walon.li@hpe.com>
To: devel@edk2.groups.io
Cc: walon.li@hpe.com, nickle.wang@hpe.com, dandan.bi@intel.com,
	gaoliming@byosoft.com.cn
Subject: [PATCH] MdeModulePkg/PlatformDriOverrideDxe: Fix overflow condition check
Date: Thu, 13 May 2021 10:48:40 +0800	[thread overview]
Message-ID: <20210513024841.2214-1-walon.li@hpe.com> (raw)

Code mistake, VariableIndex is smaller normally than buffer+buffersize
so should not break loop.

Signed-off-by:Walon Li <walon.li@hpe.com>
---
 .../Universal/PlatformDriOverrideDxe/PlatDriOverrideLib.c       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideLib.c b/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideLib.c
index f91f038b7a..bd2d04452f 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;
         }
-- 
2.23.0.windows.1


             reply	other threads:[~2021-05-13  2:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-13  2:48 Li, Walon [this message]
2021-05-13  3:13 ` 回复: [PATCH] MdeModulePkg/PlatformDriOverrideDxe: Fix overflow condition check gaoliming
     [not found] ` <167E81CF2BD0E45A.10691@groups.io>
2021-05-21  5:40   ` 回复: [edk2-devel] " gaoliming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210513024841.2214-1-walon.li@hpe.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox