diff options
author | Qiu Shumin <shumin.qiu@intel.com> | 2016-04-28 13:28:53 +0800 |
---|---|---|
committer | Qiu Shumin <shumin.qiu@intel.com> | 2016-04-29 13:23:19 +0800 |
commit | 6d3911d40610c01e843a35cefd1fec57f98a4fc2 (patch) | |
tree | 9f5fd52dc346a5049d1b04291f8db561afc5589f /ShellPkg | |
parent | 91f51fcc84d9ce3b801fdd895e514cd5525975c7 (diff) | |
download | edk2-platforms-6d3911d40610c01e843a35cefd1fec57f98a4fc2.tar.xz |
ShellPkg: Add NULL pointer check.
Add pointer check to avoid NULL pointer dereferenced.
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Tapan Shah <tapandshah@hpe.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hpe.com>
Diffstat (limited to 'ShellPkg')
-rw-r--r-- | ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c index 58f1814b87..a81d1f208a 100644 --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c @@ -301,14 +301,26 @@ GraphicsOutputProtocolDumpInformation( SHELL_FREE_NON_NULL (Temp); - Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_GOP_RES_LIST_MAIN), NULL); + Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_GOP_RES_LIST_MAIN), NULL);
+ if (Temp == NULL) {
+ SHELL_FREE_NON_NULL (RetVal);
+ goto EXIT;
+ }
TempRetVal = CatSPrint (RetVal, Temp); - SHELL_FREE_NON_NULL (RetVal); + SHELL_FREE_NON_NULL (RetVal);
+ if (TempRetVal == NULL) {
+ goto EXIT;
+ }
RetVal = TempRetVal; SHELL_FREE_NON_NULL (Temp); - Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_GOP_RES_LIST_ENTRY), NULL); + Temp = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN (STR_GOP_RES_LIST_ENTRY), NULL);
+ if (Temp == NULL) {
+ SHELL_FREE_NON_NULL (RetVal);
+ goto EXIT;
+ }
+
for (Mode = 0; Mode < GraphicsOutput->Mode->MaxMode; Mode++) { Status = GraphicsOutput->QueryMode ( @@ -334,6 +346,8 @@ GraphicsOutputProtocolDumpInformation( RetVal = TempRetVal; } +
+EXIT:
SHELL_FREE_NON_NULL(Temp);
SHELL_FREE_NON_NULL(Fmt);
|