From 324abc494213a0ac2d0bb2153842ba4692737b43 Mon Sep 17 00:00:00 2001 From: tb Date: Wed, 11 Oct 2023 13:12:46 +0000 Subject: [PATCH] Ensure that out_value is initialized even if out_type is NULL This fixes the printf in the x509_algor regress. ok jsing --- lib/libcrypto/asn1/x_algor.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/libcrypto/asn1/x_algor.c b/lib/libcrypto/asn1/x_algor.c index 47bde7b97e2..08742c5f1c9 100644 --- a/lib/libcrypto/asn1/x_algor.c +++ b/lib/libcrypto/asn1/x_algor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_algor.c,v 1.28 2023/10/11 13:10:13 tb Exp $ */ +/* $OpenBSD: x_algor.c,v 1.29 2023/10/11 13:12:46 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -185,6 +185,10 @@ X509_ALGOR_get0(const ASN1_OBJECT **out_aobj, int *out_type, if (out_aobj != NULL) *out_aobj = alg->algorithm; + /* Ensure out_value is not left uninitialized if out_type is NULL. */ + if (out_value != NULL) + *out_value = NULL; + if (out_type == NULL) return; -- 2.20.1