From 0c1950ba5e6c0a982a763ccd5d325ddbf236ad28 Mon Sep 17 00:00:00 2001 From: ydong10 Date: Thu, 13 Oct 2011 02:37:35 +0000 Subject: [PATCH] Check the pointer before use it to avoid potential access violation. Signed-off-by: ydong10 Reviewed-by: jcarsey git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12533 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Library/UefiShellLib/UefiShellLib.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c index 474aecb7ae..42ae6e9bb0 100644 --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c @@ -2236,14 +2236,9 @@ ShellCommandLineGetFlag ( CHAR16 *TempString; // - // ASSERT that both CheckPackage and KeyString aren't NULL + // return FALSE for no package or KeyString is NULL // - ASSERT(KeyString != NULL); - - // - // return FALSE for no package - // - if (CheckPackage == NULL) { + if (CheckPackage == NULL || KeyString == NULL) { return (FALSE); } @@ -2305,9 +2300,9 @@ ShellCommandLineGetValue ( CHAR16 *TempString; // - // check for CheckPackage == NULL + // return NULL for no package or KeyString is NULL // - if (CheckPackage == NULL) { + if (CheckPackage == NULL || KeyString == NULL) { return (NULL); } -- 2.39.2