From bd3445a74754f3eeda9d2f2cc89803c27f046531 Mon Sep 17 00:00:00 2001 From: Qiu Shumin Date: Fri, 18 Dec 2015 07:40:05 +0000 Subject: 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 Reviewed-by: Ruiyu Ni git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2015@19410 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ShellPkg/Library') diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c index 3f08cc84dc..7b26e4d27f 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c @@ -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; } -- cgit v1.2.3