From e8cd9b804126aabe15cd53ec44b7ff4c7e95763b Mon Sep 17 00:00:00 2001 From: Chao Zhang Date: Wed, 27 Jan 2016 02:46:51 +0000 Subject: SecurityPkg: SecureBootConfigDxe: Fix potential NULL pointer dereference Fix SecureBoot potential NULL pointer dereference. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chao Zhang Reviewed-by: Qiu Shumin git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19751 6f19259b-4bc3-4df7-8a09-765794883524 --- .../SecureBootConfigDxe/SecureBootConfigImpl.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'SecurityPkg/VariableAuthenticated') diff --git a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c index e0f934bbb4..e2340e6302 100644 --- a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c +++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c @@ -3075,16 +3075,17 @@ EFI_STATUS UpdateSecureBootString( IN SECUREBOOT_CONFIG_PRIVATE_DATA *Private ) { - EFI_STATUS Status; UINT8 CurSecureBootMode; UINT8 *SecureBoot; + SecureBoot = NULL; + // // Get current secure boot state. // - Status = GetVariable2 (EFI_SECURE_BOOT_MODE_NAME, &gEfiGlobalVariableGuid, (VOID**)&SecureBoot, NULL); - if (EFI_ERROR(Status)) { - return Status; + GetVariable2 (EFI_SECURE_BOOT_MODE_NAME, &gEfiGlobalVariableGuid, (VOID**)&SecureBoot, NULL); + if (SecureBoot == NULL) { + return EFI_NOT_FOUND; } if (*SecureBoot == SECURE_BOOT_MODE_ENABLE) { -- cgit v1.2.3