summaryrefslogtreecommitdiff
path: root/SecurityPkg
diff options
context:
space:
mode:
authorsfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524>2012-04-05 02:39:46 +0000
committersfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524>2012-04-05 02:39:46 +0000
commitba57d4fdf0dbb546160852b13676f0baea5918df (patch)
tree3a100b9ad72f08c084d90669c27d899009c623ac /SecurityPkg
parent3b553e0ab2146ef2055c969a1893b453b2023cf4 (diff)
downloadedk2-platforms-ba57d4fdf0dbb546160852b13676f0baea5918df.tar.xz
Add pointer check for NULL before dereference it.
Signed-off-by: Fu, Siyuan <siyuan.fu@intel.com> Reviewed-by: Dong, Guo <guo.dong@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13162 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'SecurityPkg')
-rw-r--r--SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c7
1 files changed, 7 insertions, 0 deletions
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)) {