RT3053: Check for NULL before dereferencing
authorPhillip Hellewell <sshock@gmail.com>
Sun, 12 Jun 2016 00:04:21 +0000 (20:04 -0400)
committerRich Salz <rsalz@openssl.org>
Sun, 12 Jun 2016 11:50:32 +0000 (07:50 -0400)
Reviewed-by: Tim Hudson <tjh@openssl.org>
crypto/cms/cms_lib.c

index 53eade3..f9c73d1 100644 (file)
@@ -345,6 +345,8 @@ static STACK_OF(CMS_CertificateChoices)
         return &cms->d.signedData->certificates;
 
     case NID_pkcs7_enveloped:
+        if (cms->d.envelopedData->originatorInfo == NULL)
+            return NULL;
         return &cms->d.envelopedData->originatorInfo->certificates;
 
     default:
@@ -420,6 +422,8 @@ static STACK_OF(CMS_RevocationInfoChoice)
         return &cms->d.signedData->crls;
 
     case NID_pkcs7_enveloped:
+        if (cms->d.envelopedData->originatorInfo == NULL)
+            return NULL;
         return &cms->d.envelopedData->originatorInfo->crls;
 
     default: