From: "cron2 (Code Review)" Date: Thu, 17 Apr 2025 14:05:34 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., lstipakov@...277..., antonio@...2726... Message-ID: <0774c11a09e1de40955d079607c82af4287ec824-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="NCjLrZz2f+Y="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: ssl_openssl.c: Prevent potential double-free List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: stipa Cc: plaisthos , flichtenheld , openvpn-devel --NCjLrZz2f+Y= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/94= 2?usp=3Demail ) Change subject: ssl_openssl.c: Prevent potential double-free ...................................................................... ssl_openssl.c: Prevent potential double-free Fixes a potential double-free issue in tls_ctx_load_cert_uri() by explicitly nullifying the pointer immediately after calling OSSL_STORE_INFO_free(info). This ensures that subsequent cleanup won't attempt to free the same structure again. Github: closes OpenVPN/openvpn#726 Change-Id: I4507be07cd5573b2117e837ef03187535a38a4b1 Signed-off-by: Lev Stipakov Acked-by: Antonio Quartulli Message-Id: <20250417134636.21279-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31= 478.html Signed-off-by: Gert Doering --- M src/openvpn/ssl_openssl.c 1 file changed, 2 insertions(+), 0 deletions(-) diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c index d1d5d3e..f7be50c 100644 --- a/src/openvpn/ssl_openssl.c +++ b/src/openvpn/ssl_openssl.c @@ -1152,6 +1152,7 @@ goto end; } OSSL_STORE_INFO_free(info); + info =3D NULL; /* iterate through the store and add extra certificates if any to the = chain */ while (!OSSL_STORE_eof(store_ctx)) @@ -1170,6 +1171,7 @@ break; } OSSL_STORE_INFO_free(info); + info =3D NULL; } end: -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/942?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I4507be07cd5573b2117e837ef03187535a38a4b1 Gerrit-Change-Number: 942 Gerrit-PatchSet: 5 Gerrit-Owner: stipa Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: ordex Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: merged --NCjLrZz2f+Y= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

ssl_openssl.c: Prevent potential double-free
Fixes a potential double-free issue in tls_ctx_load_cert_uri()
by = explicitly nullifying the pointer immediately after calling
OSSL_STORE_I= NFO_free(info).

This ensures that subsequent cleanup won't attem= pt to free the same
structure again.

Github: closes OpenVPN/openv= pn#726

Change-Id: I4507be07cd5573b2117e837ef03187535a38a4b1
Signe= d-off-by: Lev Stipakov <lev@...515...>
Acked-by: Antonio Quartulli= <antonio@...2726...>
Message-Id: <20250417134636.21279-1-gert@= ...1296...>
URL: https://www.mail-archive.com/openvpn-devel@...1885...= rceforge.net/msg31478.html
Signed-off-by: Gert Doering <gert@...1725...= ..>
---
M src/openvpn/ssl_openssl.c
1 file changed, 2 insertion= s(+), 0 deletions(-)

diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c
index d1d5d3e..f7be50c 100644
--- a/src/openvpn/= ssl_openssl.c
+++ b/src/openvpn/ssl_openssl.c
@@ -1152,6 +1152,7 @@
goto end;
}
OSSL_STORE_INFO_free(info);
+ info =3D NULL;

/* iterate through the store and add extra certificates= if any to the chain */
while (!OSSL_STORE_eof(store_c= tx))
@@ -1170,6 +1171,7 @@
bre= ak;
}
OSSL_STORE_INFO_fre= e(info);
+ inf= o =3D NULL;
}

end:<= /span>

To view, visit change 942. To unsubscribe, o= r for help writing mail filters, visit settings.

=
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4507be07cd5573b2117e837ef03= 187535a38a4b1
Gerrit-Change-Number: 942
Gerrit-PatchSet: 5
Gerrit-Owner: stipa <lstipakov@...277...>= ;
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: ordex <antonio@...2726...&= gt;
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: merged
--NCjLrZz2f+Y=--