diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/pkcs7/pk7_doit.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/libcrypto/pkcs7/pk7_doit.c b/src/lib/libcrypto/pkcs7/pk7_doit.c index 936226d736..5aa4a914cf 100644 --- a/src/lib/libcrypto/pkcs7/pk7_doit.c +++ b/src/lib/libcrypto/pkcs7/pk7_doit.c | |||
| @@ -639,10 +639,10 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) | |||
| 639 | * EOF and encode the last few bytes */ | 639 | * EOF and encode the last few bytes */ |
| 640 | BIO_set_mem_eof_return(bio,0); | 640 | BIO_set_mem_eof_return(bio,0); |
| 641 | 641 | ||
| 642 | if (data_body->length > 0) | 642 | if (data_body != NULL && data_body->length > 0) |
| 643 | BIO_write(bio,(char *)data_body->data,data_body->length); | 643 | BIO_write(bio,(char *)data_body->data,data_body->length); |
| 644 | #else | 644 | #else |
| 645 | if (data_body->length > 0) | 645 | if (data_body != NULL && data_body->length > 0) |
| 646 | bio = BIO_new_mem_buf(data_body->data,data_body->length); | 646 | bio = BIO_new_mem_buf(data_body->data,data_body->length); |
| 647 | else { | 647 | else { |
| 648 | bio=BIO_new(BIO_s_mem()); | 648 | bio=BIO_new(BIO_s_mem()); |
| @@ -788,6 +788,10 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) | |||
| 788 | case NID_pkcs7_signed: | 788 | case NID_pkcs7_signed: |
| 789 | si_sk=p7->d.sign->signer_info; | 789 | si_sk=p7->d.sign->signer_info; |
| 790 | os=PKCS7_get_octet_string(p7->d.sign->contents); | 790 | os=PKCS7_get_octet_string(p7->d.sign->contents); |
| 791 | if (os == NULL) { | ||
| 792 | PKCS7err(PKCS7_F_PKCS7_DATAFINAL, PKCS7_R_DECODE_ERROR); | ||
| 793 | goto err; | ||
| 794 | } | ||
| 791 | /* If detached data then the content is excluded */ | 795 | /* If detached data then the content is excluded */ |
| 792 | if(PKCS7_type_is_data(p7->d.sign->contents) && p7->detached) { | 796 | if(PKCS7_type_is_data(p7->d.sign->contents) && p7->detached) { |
| 793 | M_ASN1_OCTET_STRING_free(os); | 797 | M_ASN1_OCTET_STRING_free(os); |
| @@ -797,6 +801,10 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) | |||
| 797 | 801 | ||
| 798 | case NID_pkcs7_digest: | 802 | case NID_pkcs7_digest: |
| 799 | os=PKCS7_get_octet_string(p7->d.digest->contents); | 803 | os=PKCS7_get_octet_string(p7->d.digest->contents); |
| 804 | if (os == NULL) { | ||
| 805 | PKCS7err(PKCS7_F_PKCS7_DATAFINAL, PKCS7_R_DECODE_ERROR); | ||
| 806 | goto err; | ||
| 807 | } | ||
| 800 | /* If detached data then the content is excluded */ | 808 | /* If detached data then the content is excluded */ |
| 801 | if(PKCS7_type_is_data(p7->d.digest->contents) && p7->detached) | 809 | if(PKCS7_type_is_data(p7->d.digest->contents) && p7->detached) |
| 802 | { | 810 | { |
