From 72c8a89a653a6d393969d928b18fde86cf021901 Mon Sep 17 00:00:00 2001 From: ydong10 Date: Thu, 23 Jun 2011 01:26:06 +0000 Subject: [PATCH] Add check code to avoid access violation. Signed-off-by: ydong10 Reviewed-by: jcarsey git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11873 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c index 5203f11f9b..1b6b189f25 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c @@ -64,6 +64,10 @@ FindHiiHandleViaDevPath( return (Status); } + if (HandleBuffer == NULL) { + return EFI_NOT_FOUND; + } + for (LoopVariable = 0 ; LoopVariable < (HandleBufferSize/sizeof(HandleBuffer[0])) && *HiiHandle == NULL ; LoopVariable++) { MainBufferSize = 0; MainBuffer = NULL;