From: "syzzer (Code Review)" Date: Sat, 6 Dec 2025 20:50:57 +0000 References: Reply-To: steffan@...1856..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="0Znq5AEbdIQ="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: mbedtls: gracefully exit if certificate file is NULL List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --0Znq5AEbdIQ= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1419?usp=3Demail to review the following change. Change subject: mbedtls: gracefully exit if certificate file is NULL ...................................................................... mbedtls: gracefully exit if certificate file is NULL Instead of crashing because we feed a NULL pointer to strlen(), gracefully exit with an error message. While at it, improve the error message a bit. Change-Id: I0d592d9d0c7ead296869f933c206c5d55e6cbed1 Reported-By: Joshua Rogers Found-by: ZeroPath (https://zeropath.com/) Signed-off-by: Steffan Karger --- M src/openvpn/ssl_mbedtls.c 1 file changed, 5 insertions(+), 1 deletion(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/19/1419/1 diff --git a/src/openvpn/ssl_mbedtls.c b/src/openvpn/ssl_mbedtls.c index 83fca78..3440319 100644 --- a/src/openvpn/ssl_mbedtls.c +++ b/src/openvpn/ssl_mbedtls.c @@ -466,10 +466,14 @@ if (cert_inline) { + if (!cert_file) + { + msg(M_FATAL, "Cannot load inline certificate: NULL"); + } if (!mbed_ok(mbedtls_x509_crt_parse(ctx->crt_chain, (const unsigne= d char *)cert_file, strlen(cert_file) + 1))) { - msg(M_FATAL, "Cannot load inline certificate file"); + msg(M_FATAL, "Cannot load inline certificate"); } } else -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1419?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newchange Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I0d592d9d0c7ead296869f933c206c5d55e6cbed1 Gerrit-Change-Number: 1419 Gerrit-PatchSet: 1 Gerrit-Owner: syzzer Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos --0Znq5AEbdIQ= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: plaisthos.

syzzer would like plaisthos to review this change.

V= iew Change

mbedtls: gracefully exit if certificate fil=
e is NULL

Instead of crashing because we feed a NULL pointer to strl= en(),
gracefully exit with an error message.

While at it, improve= the error message a bit.

Change-Id: I0d592d9d0c7ead296869f933c206c5= d55e6cbed1
Reported-By: Joshua Rogers <contact@...2949...>
Foun= d-by: ZeroPath (https://zeropath.com/)
Signed-off-by: Steffan Karger <= ;steffan@...1856...>
---
M src/openvpn/ssl_mbedtls.c
1 file cha= nged, 5 insertions(+), 1 deletion(-)

git pull ss=
h://gerrit.openvpn.net:29418/openvpn refs/changes/19/1419/1
diff --=
git a/src/openvpn/ssl_mbedtls.c b/src/openvpn/ssl_mbedtls.c
index 83fca78..3440319 100644
--- a/src/openvpn/ssl_mbedtl= s.c
+++ b/src/openvpn/ssl_mbedtls.c
@@ -466= ,10 +466,14 @@

if (cert_inline)
{
+ = if (!cert_file)
+ = msg(M_FATAL, "Cannot load inline certificate: NULL");=
+ }
= if (!mbed_ok(mbedtls_x509_crt_parse(ctx->crt_chain, (const unsi= gned char *)cert_file,
= strlen(cert_file) + 1)))
{
- msg(M_FATAL, "Canno= t load inline certificate file");

+ msg(M_FATAL, "Cannot load inline certif= icate");
}
}
<= span> else

To view, visit change 1419= . To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0d592d9d0c7ead296869f933c20= 6c5d55e6cbed1
Gerrit-Change-Number: 1419
Gerrit-PatchSet: 1
Gerrit-Owner: syzzer <steffan@...1856...>= ;
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
= --0Znq5AEbdIQ=--