[edk2] [PATCH 2/2] ShellPkg/UefiDpLib: Add check to avoid NULL pointer dereference

Hao Wu posted 2 patches 7 years, 8 months ago
[edk2] [PATCH 2/2] ShellPkg/UefiDpLib: Add check to avoid NULL pointer dereference
Posted by Hao Wu 7 years, 8 months ago
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 ShellPkg/Library/UefiDpLib/Dp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ShellPkg/Library/UefiDpLib/Dp.c b/ShellPkg/Library/UefiDpLib/Dp.c
index 33f69a0..35ead75 100644
--- a/ShellPkg/Library/UefiDpLib/Dp.c
+++ b/ShellPkg/Library/UefiDpLib/Dp.c
@@ -272,7 +272,7 @@ ShellCommandRunDp (
   //      EndCount = Value counter counts to before it needs to be reset
   //
   Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid, (VOID **) &PerformanceProperty);
-  if (EFI_ERROR (Status)) {
+  if (EFI_ERROR (Status) || (PerformanceProperty == NULL)) {
     ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PERF_PROPERTY_NOT_FOUND), gDpHiiHandle);
     goto Done;
   }
-- 
1.9.5.msysgit.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel