]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: Initialize the local pointer to avoid potential suspicious dereference.
authorQiu Shumin <shumin.qiu@intel.com>
Sun, 13 Dec 2015 08:44:49 +0000 (08:44 +0000)
committershenshushi <shenshushi@Edk2>
Sun, 13 Dec 2015 08:44:49 +0000 (08:44 +0000)
1. Initialize the local pointer 'HandleBuffer'.
2. When 'LocateHandleBuffer' return error 'HandleBuffer' is expected unchanged, add code make sure this.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19229 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c

index 3f08cc84dc244f4c70a974eae94b8b56a0e1f9e9..7b26e4d27f6e3eb3250a91c029b88302eb4a8c52 100644 (file)
@@ -317,6 +317,7 @@ ShellMmLocateIoProtocol (
   }\r
 \r
   *PciRootBridgeIo = NULL;\r
+  HandleBuffer     = NULL;\r
   Status = gBS->LocateHandleBuffer (\r
                   ByProtocol,\r
                   &gEfiPciRootBridgeIoProtocolGuid,\r
@@ -324,7 +325,7 @@ ShellMmLocateIoProtocol (
                   &HandleCount,\r
                   &HandleBuffer\r
                   );\r
-  if (EFI_ERROR (Status) || (HandleCount == 0)) {\r
+  if (EFI_ERROR (Status) || (HandleCount == 0) || (HandleBuffer == NULL)) {\r
     return FALSE;\r
   }\r
 \r