summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libcrypto/cms/cms_lib.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/lib/libcrypto/cms/cms_lib.c b/src/lib/libcrypto/cms/cms_lib.c
index 950d8764ad..5891302fdf 100644
--- a/src/lib/libcrypto/cms/cms_lib.c
+++ b/src/lib/libcrypto/cms/cms_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cms_lib.c,v 1.22 2023/08/24 04:46:56 tb Exp $ */ 1/* $OpenBSD: cms_lib.c,v 1.23 2023/08/24 04:54:26 tb Exp $ */
2/* 2/*
3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
4 * project. 4 * project.
@@ -124,20 +124,20 @@ cms_Data_create(void)
124BIO * 124BIO *
125cms_content_bio(CMS_ContentInfo *cms) 125cms_content_bio(CMS_ContentInfo *cms)
126{ 126{
127 ASN1_OCTET_STRING **pos = CMS_get0_content(cms); 127 ASN1_OCTET_STRING **pos;
128 128
129 if (!pos) 129 if ((pos = CMS_get0_content(cms)) == NULL)
130 return NULL; 130 return NULL;
131 /* If content detached data goes nowhere: create NULL BIO */ 131
132 if (!*pos) 132 /* If content is detached, data goes nowhere: create null BIO. */
133 if (*pos == NULL)
133 return BIO_new(BIO_s_null()); 134 return BIO_new(BIO_s_null());
134 /* 135
135 * If content not detached and created return memory BIO 136 /* If content is not detached and was created, return memory BIO. */
136 */ 137 if ((*pos)->flags == ASN1_STRING_FLAG_CONT)
137 if (!*pos || ((*pos)->flags == ASN1_STRING_FLAG_CONT))
138 return BIO_new(BIO_s_mem()); 138 return BIO_new(BIO_s_mem());
139 139
140 /* Else content was read in: return read only BIO for it */ 140 /* Else content was read in: return read-only BIO for it. */
141 return BIO_new_mem_buf((*pos)->data, (*pos)->length); 141 return BIO_new_mem_buf((*pos)->data, (*pos)->length);
142} 142}
143 143