From ba57d4fdf0dbb546160852b13676f0baea5918df Mon Sep 17 00:00:00 2001 From: sfu5 Date: Thu, 5 Apr 2012 02:39:46 +0000 Subject: Add pointer check for NULL before dereference it. Signed-off-by: Fu, Siyuan Reviewed-by: Dong, Guo git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13162 6f19259b-4bc3-4df7-8a09-765794883524 --- .../SecureBootConfigDxe/SecureBootConfigImpl.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'SecurityPkg') diff --git a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c index c80c5eafac..cdfc08acc2 100644 --- a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c +++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c @@ -180,6 +180,7 @@ CreatePkRsaSignatureList ( DEBUG ((EFI_D_ERROR, "Can't Open the file for PK enrolling.\n")); goto ON_EXIT; } + ASSERT (KeyBlob != NULL); KeyInfo = (CPL_KEY_INFO *)KeyBlob; if (KeyInfo->KeyLengthInBits/8 != WIN_CERT_UEFI_RSA2048_SIZE) { @@ -282,6 +283,7 @@ CreatePkX509SignatureList ( if (EFI_ERROR (Status)) { goto ON_EXIT; } + ASSERT (X509Data != NULL); // // Allocate space for PK certificate list and initialize it. @@ -385,6 +387,7 @@ EnrollPlatformKey ( goto ON_EXIT; } } + ASSERT (PkCert != NULL); // // Set Platform Key variable. @@ -490,6 +493,7 @@ EnrollRsa2048ToKek ( if (EFI_ERROR (Status)) { goto ON_EXIT; } + ASSERT (KeyBlob != NULL); KeyInfo = (CPL_KEY_INFO *) KeyBlob; if (KeyInfo->KeyLengthInBits / 8 != WIN_CERT_UEFI_RSA2048_SIZE) { DEBUG ((DEBUG_ERROR, "Unsupported key length, Only RSA2048 is supported.\n")); @@ -641,6 +645,7 @@ EnrollX509ToKek ( if (EFI_ERROR (Status)) { goto ON_EXIT; } + ASSERT (X509Data != NULL); KekSigListSize = sizeof(EFI_SIGNATURE_LIST) + sizeof(EFI_SIGNATURE_DATA) - 1 + X509DataSize; KekSigList = (EFI_SIGNATURE_LIST*) AllocateZeroPool (KekSigListSize); @@ -792,6 +797,7 @@ EnrollX509toSigDB ( if (EFI_ERROR (Status)) { goto ON_EXIT; } + ASSERT (X509Data != NULL); SigDBSize = sizeof(EFI_SIGNATURE_LIST) + sizeof(EFI_SIGNATURE_DATA) - 1 + X509DataSize; @@ -1299,6 +1305,7 @@ EnrollImageSignatureToSigDB ( if (EFI_ERROR (Status)) { goto ON_EXIT; } + ASSERT (mImageBase != NULL); Status = LoadPeImage (); if (EFI_ERROR (Status)) { -- cgit v1.2.3