Add check for pointer Variable to ensure it is not NULL when used.

Cc: Michael Kubacki <michael.a.kuba...@intel.com>
Cc: Chasel Chiu <chasel.c...@intel.com>
Cc: Nate DeSimone <nathaniel.l.desim...@intel.com>
Cc: Liming Gao <liming....@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zh...@intel.com>
---
 .../Test/Library/TestPointCheckLib/DxeCheckUefiSecureBoot.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git 
a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckUefiSecureBoot.c
 
b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckUefiSecureBoot.c
index b53a09ab..f5125ede 100644
--- 
a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckUefiSecureBoot.c
+++ 
b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckUefiSecureBoot.c
@@ -52,6 +52,9 @@ TestPointCheckUefiSecureBoot (
   ReturnStatus = EFI_SUCCESS;
   for (Index = 0; Index < 
sizeof(mUefiSecureBootVariable)/sizeof(mUefiSecureBootVariable[0]); Index++) {
     Status = GetVariable2 (mUefiSecureBootVariable[Index].Name, 
mUefiSecureBootVariable[Index].Guid, &Variable, &Size);
+    if(Variable == NULL) {
+      return EFI_NOT_FOUND;
+    }
     if (EFI_ERROR(Status)) {
       DEBUG ((DEBUG_ERROR, "Variable - %S not found\n", 
mUefiSecureBootVariable[Index].Name));
       ReturnStatus = Status;
@@ -69,6 +72,9 @@ TestPointCheckUefiSecureBoot (
 
   for (Index = 0; Index < 
sizeof(mUefiSecureBootModeVariable)/sizeof(mUefiSecureBootModeVariable[0]); 
Index++) {
     Status = GetVariable2 (mUefiSecureBootModeVariable[Index].Name, 
mUefiSecureBootModeVariable[Index].Guid, &Variable, &Size);
+    if(Variable == NULL) {
+      return EFI_NOT_FOUND;
+    }
     if (EFI_ERROR(Status)) {
       DEBUG ((DEBUG_ERROR, "Variable - %S not found\n", 
mUefiSecureBootModeVariable[Index].Name));
       ReturnStatus = Status;
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#46673): https://edk2.groups.io/g/devel/message/46673
Mute This Topic: https://groups.io/mt/33110622/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to