=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/openssl/cms.c,v retrieving revision 1.16 retrieving revision 1.17 diff -c -r1.16 -r1.17 *** src/usr.bin/openssl/cms.c 2019/11/19 10:28:18 1.16 --- src/usr.bin/openssl/cms.c 2020/01/04 14:17:55 1.17 *************** *** 1,4 **** ! /* $OpenBSD: cms.c,v 1.16 2019/11/19 10:28:18 inoguchi Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. */ --- 1,4 ---- ! /* $OpenBSD: cms.c,v 1.17 2020/01/04 14:17:55 inoguchi Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. */ *************** *** 734,740 **** } if (certsoutfile) { STACK_OF(X509) *allcerts; ! allcerts = CMS_get1_certs(cms); if (!save_certs(certsoutfile, allcerts)) { BIO_printf(bio_err, "Error writing certs to %s\n", --- 734,741 ---- } if (certsoutfile) { STACK_OF(X509) *allcerts; ! if ((allcerts = CMS_get1_certs(cms)) == NULL) ! goto end; if (!save_certs(certsoutfile, allcerts)) { BIO_printf(bio_err, "Error writing certs to %s\n", *************** *** 816,822 **** goto end; if (kparam != NULL) { EVP_PKEY_CTX *pctx; ! pctx = CMS_RecipientInfo_get0_pkey_ctx(ri); if (!cms_set_pkey_param(pctx, kparam->param)) goto end; } --- 817,824 ---- goto end; if (kparam != NULL) { EVP_PKEY_CTX *pctx; ! if ((pctx = CMS_RecipientInfo_get0_pkey_ctx(ri)) == NULL) ! goto end; if (!cms_set_pkey_param(pctx, kparam->param)) goto end; } *************** *** 878,884 **** if (!cms) goto end; if (econtent_type) ! CMS_set1_eContentType(cms, econtent_type); if (rr_to) { rr = make_receipt_request(rr_to, rr_allorfirst, --- 880,887 ---- if (!cms) goto end; if (econtent_type) ! if (!CMS_set1_eContentType(cms, econtent_type)) ! goto end; if (rr_to) { rr = make_receipt_request(rr_to, rr_allorfirst, *************** *** 917,923 **** goto end; if (kparam != NULL) { EVP_PKEY_CTX *pctx; ! pctx = CMS_SignerInfo_get0_pkey_ctx(si); if (!cms_set_pkey_param(pctx, kparam->param)) goto end; } --- 920,927 ---- goto end; if (kparam != NULL) { EVP_PKEY_CTX *pctx; ! if ((pctx = CMS_SignerInfo_get0_pkey_ctx(si)) == NULL) ! goto end; if (!cms_set_pkey_param(pctx, kparam->param)) goto end; } *************** *** 997,1003 **** } if (signerfile) { STACK_OF(X509) *signers; ! signers = CMS_get0_signers(cms); if (!save_certs(signerfile, signers)) { BIO_printf(bio_err, "Error writing signers to %s\n", --- 1001,1008 ---- } if (signerfile) { STACK_OF(X509) *signers; ! if ((signers = CMS_get0_signers(cms)) == NULL) ! goto end; if (!save_certs(signerfile, signers)) { BIO_printf(bio_err, "Error writing signers to %s\n", *************** *** 1019,1026 **** } } else { if (noout) { ! if (print) ! CMS_ContentInfo_print_ctx(out, cms, 0, NULL); } else if (outformat == FORMAT_SMIME) { if (to) BIO_printf(out, "To: %s\n", to); --- 1024,1032 ---- } } else { if (noout) { ! if (print && ! !CMS_ContentInfo_print_ctx(out, cms, 0, NULL)) ! goto end; } else if (outformat == FORMAT_SMIME) { if (to) BIO_printf(out, "To: %s\n", to); *************** *** 1153,1159 **** ASN1_STRING *scid; int i, rv; ! sis = CMS_get0_SignerInfos(cms); for (i = 0; i < sk_CMS_SignerInfo_num(sis); i++) { si = sk_CMS_SignerInfo_value(sis, i); rv = CMS_get1_ReceiptRequest(si, &rr); --- 1159,1166 ---- ASN1_STRING *scid; int i, rv; ! if ((sis = CMS_get0_SignerInfos(cms)) == NULL) ! return; for (i = 0; i < sk_CMS_SignerInfo_num(sis); i++) { si = sk_CMS_SignerInfo_value(sis, i); rv = CMS_get1_ReceiptRequest(si, &rr); *************** *** 1242,1249 **** goto err; } else rct_from = NULL; ! rr = CMS_ReceiptRequest_create0(NULL, -1, rr_allorfirst, rct_from, ! rct_to); return rr; err: --- 1249,1259 ---- goto err; } else rct_from = NULL; ! ! if ((rr = CMS_ReceiptRequest_create0(NULL, -1, rr_allorfirst, rct_from, ! rct_to)) == NULL) ! goto err; ! return rr; err: