Skip to content

Commit bbb4d91

Browse files
committed
CryptoPkg: Fix the pkcs7 get cert fuzz
Signed-off-by: Wenxing Hou <[email protected]>
1 parent dae7bfe commit bbb4d91

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

CryptoPkg/Library/BaseCryptLibMbedTls/Pk/CryptPkcs7VerifyCommon.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,8 @@ Pkcs7GetSignedData (
431431
goto End;
432432
}
433433

434+
FreePool (MoreCert);
435+
434436
LastCert = &(SignedData->Certificates);
435437

436438
while(CertNum--) {
@@ -448,8 +450,10 @@ Pkcs7GetSignedData (
448450
Ret = MbedTlsPkcs7GetSignersInfoSet (&P, End, &SignedData->SignerInfos);
449451
}
450452

453+
return Ret;
454+
451455
End:
452-
if (MoreCert != NULL) {
456+
if ((MoreCert != NULL) && (CertNum !=0)) {
453457
FreePool (MoreCert);
454458
MoreCert = NULL;
455459
}

0 commit comments

Comments
 (0)