RT3053: Check for NULL before dereferencing

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 6b3602882e)
This commit is contained in:
Phillip Hellewell 2016-06-11 20:04:21 -04:00 committed by Rich Salz
parent 5bbdc26cad
commit 63b2499b67

View file

@ -413,6 +413,8 @@ static STACK_OF(CMS_CertificateChoices)
return &cms->d.signedData->certificates; return &cms->d.signedData->certificates;
case NID_pkcs7_enveloped: case NID_pkcs7_enveloped:
if (cms->d.envelopedData->originatorInfo == NULL)
return NULL;
return &cms->d.envelopedData->originatorInfo->certificates; return &cms->d.envelopedData->originatorInfo->certificates;
default: default:
@ -488,6 +490,8 @@ static STACK_OF(CMS_RevocationInfoChoice)
return &cms->d.signedData->crls; return &cms->d.signedData->crls;
case NID_pkcs7_enveloped: case NID_pkcs7_enveloped:
if (cms->d.envelopedData->originatorInfo == NULL)
return NULL;
return &cms->d.envelopedData->originatorInfo->crls; return &cms->d.envelopedData->originatorInfo->crls;
default: default: