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:54:31 +0000 (07:54 -0400)
Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit 6b3602882e089aaca18828a72d9f4072e6a20252)

crypto/cms/cms_lib.c

index d6cb60d02d1525152299fd66b76d42220be2f368..6d27c4969b92c412a7f98c606bb687e492f8a35e 100644 (file)
@@ -413,6 +413,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:
@@ -488,6 +490,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: