From 680fe710dc4d18bbc793df16e3c196f4a2141e0b Mon Sep 17 00:00:00 2001
From: tb <>
Date: Tue, 18 Jun 2024 09:47:03 +0000
Subject: v3_generic_extension() use ASN1_STRING_set0()

This aligns it with do_ext_i2d()
---
 src/lib/libcrypto/x509/x509_conf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'src/lib')

diff --git a/src/lib/libcrypto/x509/x509_conf.c b/src/lib/libcrypto/x509/x509_conf.c
index 31cff79e62..a9e5076dc9 100644
--- a/src/lib/libcrypto/x509/x509_conf.c
+++ b/src/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);
 
-- 
cgit v1.2.3-55-g6feb