From: tb Date: Tue, 18 Jun 2024 09:47:03 +0000 (+0000) Subject: v3_generic_extension() use ASN1_STRING_set0() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=cab24f6dc969d6e716fd15bb846fc4c1dd911078;p=openbsd v3_generic_extension() use ASN1_STRING_set0() This aligns it with do_ext_i2d() --- diff --git a/lib/libcrypto/x509/x509_conf.c b/lib/libcrypto/x509/x509_conf.c index 31cff79e628..a9e5076dc9e 100644 --- a/lib/libcrypto/x509/x509_conf.c +++ b/lib/libcrypto/x509/x509_conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_conf.c,v 1.16 2024/06/18 09:41:33 tb Exp $ */ +/* $OpenBSD: x509_conf.c,v 1.17 2024/06/18 09:47:03 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -314,14 +314,14 @@ v3_generic_extension(const char *name, const char *value, int crit, int gen_type goto err; } - if (!(oct = ASN1_OCTET_STRING_new())) { + if ((oct = ASN1_OCTET_STRING_new()) == NULL) { X509V3error(ERR_R_MALLOC_FAILURE); goto err; } - oct->data = ext_der; - oct->length = ext_len; + ASN1_STRING_set0(oct, ext_der, ext_len); ext_der = NULL; + ext_len = 0; ext = X509_EXTENSION_create_by_OBJ(NULL, obj, crit, oct);