summaryrefslogtreecommitdiffstats
path: root/crypto/asn1
diff options
context:
space:
mode:
authoratishkov <a.tishkov@aladdin.ru>2023-07-28 13:12:38 +0300
committerTodd Short <todd.short@me.com>2023-08-04 13:29:17 -0400
commitc791e399abba8394833a2f88abaeb69f27f33b42 (patch)
tree600418dc475483a6d5f53fe030df376b735f9feb /crypto/asn1
parentbcbc7d60679b79fa4347e33c865306dce41ed985 (diff)
asn1: add ASN1_STRING_set() check result
Reviewed-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Todd Short <todd.short@me.com> (Merged from https://github.com/openssl/openssl/pull/21587)
Diffstat (limited to 'crypto/asn1')
-rw-r--r--crypto/asn1/asn1_gen.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/crypto/asn1/asn1_gen.c b/crypto/asn1/asn1_gen.c
index a7ec79faa9..1ed9d2afcf 100644
--- a/crypto/asn1/asn1_gen.c
+++ b/crypto/asn1/asn1_gen.c
@@ -698,9 +698,12 @@ static ASN1_TYPE *asn1_str2type(const char *str, int format, int utype)
atmp->value.asn1_string->data = rdata;
atmp->value.asn1_string->length = rdlen;
atmp->value.asn1_string->type = utype;
- } else if (format == ASN1_GEN_FORMAT_ASCII)
- ASN1_STRING_set(atmp->value.asn1_string, str, -1);
- else if ((format == ASN1_GEN_FORMAT_BITLIST)
+ } else if (format == ASN1_GEN_FORMAT_ASCII) {
+ if (!ASN1_STRING_set(atmp->value.asn1_string, str, -1)) {
+ ERR_raise(ERR_LIB_ASN1, ERR_R_ASN1_LIB);
+ goto bad_str;
+ }
+ } else if ((format == ASN1_GEN_FORMAT_BITLIST)
&& (utype == V_ASN1_BIT_STRING)) {
if (!CONF_parse_list
(str, ',', 1, bitstr_cb, atmp->value.bit_string)) {