Revision: 19410
          http://sourceforge.net/p/edk2/code/19410
Author:   vanjeff
Date:     2015-12-18 07:40:05 +0000 (Fri, 18 Dec 2015)
Log Message:
-----------
ShellPkg: Initialize the local pointer to avoid potential suspicious 
dereference.

1. Initialize the local pointer 'HandleBuffer'.
2. When 'LocateHandleBuffer' return error 'HandleBuffer' is expected unchanged, 
add code make sure this.

(Sync patch r19229 from main trunk.)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <[email protected]>
Reviewed-by: Ruiyu Ni <[email protected]>

Revision Links:
--------------
    http://sourceforge.net/p/edk2/code/19229

Modified Paths:
--------------
    branches/UDK2015/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c

Modified: branches/UDK2015/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
===================================================================
--- branches/UDK2015/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c   
2015-12-18 07:39:35 UTC (rev 19409)
+++ branches/UDK2015/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c   
2015-12-18 07:40:05 UTC (rev 19410)
@@ -317,6 +317,7 @@
   }
 
   *PciRootBridgeIo = NULL;
+  HandleBuffer     = NULL;
   Status = gBS->LocateHandleBuffer (
                   ByProtocol,
                   &gEfiPciRootBridgeIoProtocolGuid,
@@ -324,7 +325,7 @@
                   &HandleCount,
                   &HandleBuffer
                   );
-  if (EFI_ERROR (Status) || (HandleCount == 0)) {
+  if (EFI_ERROR (Status) || (HandleCount == 0) || (HandleBuffer == NULL)) {
     return FALSE;
   }
 


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to