public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Dandan Bi" <dandan.bi@intel.com>
To: devel@edk2.groups.io
Cc: Liming Gao <liming.gao@intel.com>,
	Eric Dong <eric.dong@intel.com>,
	Jian J Wang <jian.j.wang@intel.com>
Subject: [patch 2/2] MdeModulePkg/DisplayEngine: Zero memory before free (CVE-2019-14558)
Date: Thu, 13 Feb 2020 12:03:03 +0800	[thread overview]
Message-ID: <20200213040303.53336-3-dandan.bi@intel.com> (raw)
In-Reply-To: <20200213040303.53336-1-dandan.bi@intel.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1611

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c b/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c
index 7d9486112b..1087004939 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c
@@ -821,10 +821,11 @@ PasswordProcess (
     //
     // Old password exist, ask user for the old password
     //
     Status = ReadString (MenuOption, gPromptForPassword, StringPtr);
     if (EFI_ERROR (Status)) {
+      ZeroMem (StringPtr, (Maximum + 1) * sizeof (CHAR16));
       FreePool (StringPtr);
       return Status;
     }
 
     //
@@ -838,11 +839,11 @@ PasswordProcess (
         //
         PasswordInvalid ();
       } else {
         Status = EFI_SUCCESS;
       }
-
+      ZeroMem (StringPtr, (Maximum + 1) * sizeof (CHAR16));
       FreePool (StringPtr);
       return Status;
     }
   }
 
@@ -854,10 +855,11 @@ PasswordProcess (
   if (EFI_ERROR (Status)) {
     //
     // Reset state machine for password
     //
     Question->PasswordCheck (gFormData, Question, NULL);
+    ZeroMem (StringPtr, (Maximum + 1) * sizeof (CHAR16));
     FreePool (StringPtr);
     return Status;
   }
 
   //
@@ -869,10 +871,12 @@ PasswordProcess (
   if (EFI_ERROR (Status)) {
     //
     // Reset state machine for password
     //
     Question->PasswordCheck (gFormData, Question, NULL);
+    ZeroMem (StringPtr, (Maximum + 1) * sizeof (CHAR16));
+    ZeroMem (TempString, (Maximum + 1) * sizeof (CHAR16));
     FreePool (StringPtr);
     FreePool (TempString);
     return Status;
   }
 
-- 
2.18.0.windows.1


  parent reply	other threads:[~2020-02-13  4:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-13  4:03 [patch] MdeModulePkg/HiiDB: Remove configuration table when it's freed (CVE-2019-14586) Dandan Bi
2020-02-13  4:03 ` [patch 1/2] MdeModulePkg/String.c: Zero memory before free (CVE-2019-14558) Dandan Bi
2020-02-13  4:06   ` Wang, Jian J
2020-02-14  6:44   ` Dong, Eric
2020-02-13  4:03 ` Dandan Bi [this message]
2020-02-13  4:11   ` [patch 2/2] MdeModulePkg/DisplayEngine: " Wang, Jian J
2020-02-14  6:45   ` Dong, Eric
2020-02-13  4:05 ` [patch] MdeModulePkg/HiiDB: Remove configuration table when it's freed (CVE-2019-14586) Wang, Jian J

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=20200213040303.53336-3-dandan.bi@intel.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