]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SecurityPkg: SecureBootConfigDxe: Fix potential NULL pointer dereference
authorChao Zhang <chao.b.zhang@intel.com>
Wed, 27 Jan 2016 02:46:51 +0000 (02:46 +0000)
committerczhang46 <czhang46@Edk2>
Wed, 27 Jan 2016 02:46:51 +0000 (02:46 +0000)
Fix SecureBoot potential NULL pointer dereference.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Qiu Shumin <shumin.qiu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19751 6f19259b-4bc3-4df7-8a09-765794883524

SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c

index e0f934bbb410e1a8ea48aad1ec6c6b044e0c5f9b..e2340e63023d9ebf1a32110bb4acec2eb698cdcc 100644 (file)
@@ -3075,16 +3075,17 @@ EFI_STATUS
 UpdateSecureBootString(\r
   IN SECUREBOOT_CONFIG_PRIVATE_DATA  *Private\r
   ) {\r
-  EFI_STATUS  Status;\r
   UINT8       CurSecureBootMode;\r
   UINT8       *SecureBoot;\r
 \r
+  SecureBoot = NULL;\r
+\r
   //\r
   // Get current secure boot state.\r
   //\r
-  Status = GetVariable2 (EFI_SECURE_BOOT_MODE_NAME, &gEfiGlobalVariableGuid, (VOID**)&SecureBoot, NULL);\r
-  if (EFI_ERROR(Status)) {\r
-    return Status;\r
+  GetVariable2 (EFI_SECURE_BOOT_MODE_NAME, &gEfiGlobalVariableGuid, (VOID**)&SecureBoot, NULL);\r
+  if (SecureBoot == NULL) {\r
+    return EFI_NOT_FOUND;\r
   }\r
 \r
   if (*SecureBoot == SECURE_BOOT_MODE_ENABLE) {\r