From d8f8021cbe89187c443e6a9ee89eb3edc8248ab4 Mon Sep 17 00:00:00 2001 From: jcarsey Date: Thu, 7 Apr 2011 17:12:12 +0000 Subject: ShellParametersProtocol - remove parsing from within quoted parameters. Pci - Add missing enumeration in switch statement. For - Verify parameter before dereferencing. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11511 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Library/UefiShellLevel1CommandsLib/For.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'ShellPkg/Library/UefiShellLevel1CommandsLib') diff --git a/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c b/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c index b8e4805d92..bc26ed31bc 100644 --- a/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c +++ b/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c @@ -589,11 +589,16 @@ ShellCommandRunFor ( ASSERT(ArgSet == NULL); } - Info = (SHELL_FOR_INFO*)CurrentScriptFile->CurrentCommand->Data; - if (CurrentScriptFile->CurrentCommand->Reset) { - Info->CurrentValue = (CHAR16*)Info->Set; - FirstPass = TRUE; - CurrentScriptFile->CurrentCommand->Reset = FALSE; + if (CurrentScriptFile != NULL && CurrentScriptFile->CurrentCommand != NULL) { + Info = (SHELL_FOR_INFO*)CurrentScriptFile->CurrentCommand->Data; + if (CurrentScriptFile->CurrentCommand->Reset) { + Info->CurrentValue = (CHAR16*)Info->Set; + FirstPass = TRUE; + CurrentScriptFile->CurrentCommand->Reset = FALSE; + } + } else { + ShellStatus = SHELL_UNSUPPORTED; + Info = NULL; } if (ShellStatus == SHELL_SUCCESS) { ASSERT(Info != NULL); -- cgit v1.2.3