Fix NULL deref in apps/pkcs7
Thanks to Brian Carpenter for finding and reporting this.
Reviewed-by: Emilia Käsper <emilia@openssl.org>
(cherry picked from commit 79356a83b7
)
This commit is contained in:
parent
0b48a24ce9
commit
d31bc179b3
1 changed files with 8 additions and 4 deletions
12
apps/pkcs7.c
12
apps/pkcs7.c
|
@ -235,12 +235,16 @@ int MAIN(int argc, char **argv)
|
|||
i = OBJ_obj2nid(p7->type);
|
||||
switch (i) {
|
||||
case NID_pkcs7_signed:
|
||||
certs = p7->d.sign->cert;
|
||||
crls = p7->d.sign->crl;
|
||||
if (p7->d.sign != NULL) {
|
||||
certs = p7->d.sign->cert;
|
||||
crls = p7->d.sign->crl;
|
||||
}
|
||||
break;
|
||||
case NID_pkcs7_signedAndEnveloped:
|
||||
certs = p7->d.signed_and_enveloped->cert;
|
||||
crls = p7->d.signed_and_enveloped->crl;
|
||||
if (p7->d.signed_and_enveloped != NULL) {
|
||||
certs = p7->d.signed_and_enveloped->cert;
|
||||
crls = p7->d.signed_and_enveloped->crl;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue