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.

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
This commit is contained in:
Qiu Shumin 2015-12-13 08:44:49 +00:00 committed by shenshushi
parent 898378c2be
commit 02d3482574
1 changed files with 2 additions and 1 deletions

View File

@ -317,6 +317,7 @@ ShellMmLocateIoProtocol (
}
*PciRootBridgeIo = NULL;
HandleBuffer = NULL;
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiPciRootBridgeIoProtocolGuid,
@ -324,7 +325,7 @@ ShellMmLocateIoProtocol (
&HandleCount,
&HandleBuffer
);
if (EFI_ERROR (Status) || (HandleCount == 0)) {
if (EFI_ERROR (Status) || (HandleCount == 0) || (HandleBuffer == NULL)) {
return FALSE;
}