diff options
author | Qiu Shumin <shumin.qiu@intel.com> | 2016-04-28 13:28:53 +0800 |
---|---|---|
committer | Hao Wu <hao.a.wu@intel.com> | 2016-07-13 20:43:15 +0800 |
commit | 1c29d8d5d9060708940f434bc1ecdb6a87db9b4b (patch) | |
tree | 72caf52bc199e26559d0cbca110437dc1deff5e2 /ShellPkg | |
parent | c48cf23568a4515448d8f49f2e2cbf336bcc08ae (diff) | |
download | edk2-platforms-1c29d8d5d9060708940f434bc1ecdb6a87db9b4b.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>
(cherry picked from commit 6d3911d40610c01e843a35cefd1fec57f98a4fc2)
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);
|