Commit 33befc25 authored by Albert Astals Cid's avatar Albert Astals Cid

SignatureHandler: Fix crash on broken files

Issue #732
parent 679339e0
...@@ -49,6 +49,10 @@ char *SignatureHandler::getSignerName() ...@@ -49,6 +49,10 @@ char *SignatureHandler::getSignerName()
return nullptr; return nullptr;
CERTCertificate *cert = NSS_CMSSignerInfo_GetSigningCertificate(CMSSignerInfo, CERT_GetDefaultCertDB()); CERTCertificate *cert = NSS_CMSSignerInfo_GetSigningCertificate(CMSSignerInfo, CERT_GetDefaultCertDB());
if (!cert)
return nullptr;
return CERT_GetCommonName(&cert->subject); return CERT_GetCommonName(&cert->subject);
} }
...@@ -397,6 +401,9 @@ SignatureValidationStatus SignatureHandler::validateSignature() ...@@ -397,6 +401,9 @@ SignatureValidationStatus SignatureHandler::validateSignature()
if (!NSS_IsInitialized()) if (!NSS_IsInitialized())
return SIGNATURE_GENERIC_ERROR; return SIGNATURE_GENERIC_ERROR;
if (!hash_context)
return SIGNATURE_GENERIC_ERROR;
digest_buffer = (unsigned char *)PORT_Alloc(hash_length); digest_buffer = (unsigned char *)PORT_Alloc(hash_length);
unsigned int result_len = 0; unsigned int result_len = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment