Skip to content

Commit

Permalink
CryptoPkg: Fix the pkcs7 get cert fuzz
Browse files Browse the repository at this point in the history
Signed-off-by: Wenxing Hou <wenxing.hou@intel.com>
  • Loading branch information
Wenxing-hou committed Mar 20, 2024
1 parent 0ae8e4e commit 707ab22
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,10 @@ Pkcs7GetSignedData (
goto End;
}

if (CertNum != 0) {
FreePool (MoreCert);
}

LastCert = &(SignedData->Certificates);

while (CertNum--) {
Expand All @@ -487,8 +491,10 @@ Pkcs7GetSignedData (
Ret = MbedTlsPkcs7GetSignersInfoSet (&P, End, &SignedData->SignerInfos);
}

return Ret;

End:
if (MoreCert != NULL) {
if ((MoreCert != NULL) && (CertNum !=0)) {
FreePool (MoreCert);
MoreCert = NULL;
}
Expand Down

0 comments on commit 707ab22

Please sign in to comment.