public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Kubacki, Michael A" <michael.a.kubacki@intel.com>
To: devel@edk2.groups.io
Cc: Dandan Bi <dandan.bi@intel.com>, Liming Gao <liming.gao@intel.com>
Subject: [edk2-platforms][PATCH V1 1/1] UserInterfacePkg/UserAuthentication: Fix NULL pointer dereferences
Date: Mon, 26 Aug 2019 18:35:33 -0700	[thread overview]
Message-ID: <20190827013533.13768-1-michael.a.kubacki@intel.com> (raw)

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

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
---
 Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.c b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.c
index 55b264f4ff..b4326d380f 100644
--- a/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.c
+++ b/Platform/Intel/UserInterfaceFeaturePkg/UserAuthentication/UserAuthentication2Dxe.c
@@ -300,13 +300,16 @@ UserAuthenticationCallback (
         switch (mUserAuthenticationData->PasswordState) {
         case BROWSER_STATE_VALIDATE_PASSWORD:
           UserInputPassword = HiiGetString (mUserAuthenticationData->HiiHandle, Value->string, NULL);
+          if (UserInputPassword == NULL) {
+            return EFI_UNSUPPORTED;
+          }
           if ((StrLen (UserInputPassword) >= PASSWORD_MAX_SIZE)) {
             Status = EFI_NOT_READY;
             break;
           }
           if (UserInputPassword[0] == 0) {
             //
-            // Setup will use a NULL password to check whether the old password is set,
+            // Setup will use an empty password to check whether the old password is set,
             // If the validation is successful, means there is no old password, return
             // success to set the new password. Or need to return EFI_NOT_READY to
             // let user input the old password.
@@ -343,6 +346,9 @@ UserAuthenticationCallback (
 
         case BROWSER_STATE_SET_PASSWORD:
           UserInputPassword = HiiGetString (mUserAuthenticationData->HiiHandle, Value->string, NULL);
+          if (UserInputPassword == NULL) {
+            return EFI_UNSUPPORTED;
+          }
           if ((StrLen (UserInputPassword) >= PASSWORD_MAX_SIZE)) {
             Status = EFI_NOT_READY;
             break;
-- 
2.16.2.windows.1


             reply	other threads:[~2019-08-27  1:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-27  1:35 Kubacki, Michael A [this message]
2019-08-28  0:28 ` [edk2-platforms][PATCH V1 1/1] UserInterfacePkg/UserAuthentication: Fix NULL pointer dereferences Dandan Bi

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=20190827013533.13768-1-michael.a.kubacki@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