Change in openvpn[master]: mbedtls: gracefully exit if certificate file is NULL
A message that is not in the archive (sent off-list or not yet received): gerrit.1765054252000.I0d592d9d0c7ead296869f933c206c5d55e6cbed1@...2715...
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=email
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.
---
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
src/openvpn/ssl_mbedtls.c +5 -1
@@ -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 unsigned 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=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0d592d9d0c7ead296869f933c206c5d55e6cbed1
Gerrit-Change-Number: 1419
Gerrit-PatchSet: 1
Gerrit-Owner: syzzer <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: plaisthos, syzzer.
cron2 has posted comments on this change by syzzer. ( http://gerrit.openvpn.net/c/openvpn/+/1419?usp=email )
Change subject: mbedtls: gracefully exit if certificate file is NULL
......................................................................
Patch Set 1: Code-Review+2
(1 comment)
Patchset:
PS1:
need to test a bit how to trigger this :-)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1419?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0d592d9d0c7ead296869f933c206c5d55e6cbed1
Gerrit-Change-Number: 1419
Gerrit-PatchSet: 1
Gerrit-Owner: syzzer <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: syzzer <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Sat, 06 Dec 2025 20:58:10 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
PATCH 1/1 mbedtls: gracefully exit if certificate file is NULL
In reply to a message not in the archiveFrom: Steffan Karger <[email protected]...>
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.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1419
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1419
This mail reflects revision 1 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
src/openvpn/ssl_mbedtls.c +5 -1
@@ -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 unsigned char *)cert_file,strlen (cert_file) +1 ))) { -msg (M_FATAL ,"Cannot load inline certificate file" ); +msg (M_FATAL ,"Cannot load inline certificate" ); } }else
[Openvpn-devel] [PATCH applied] Re: mbedtls: gracefully exit if certificate file is NULL
I have not tested if I can reproduce the situation (like with an empty inline <cert></cert> cert, or somehow via management interface) or if this is caught further upstream - but this check looks quite reasonable, and the BBs are fine with it.
Your patch has been applied to the master branch.
commit d7c7caa370ad1fff1cd222e2499a77ea792c8a0e
Author: Steffan Karger Date: Sat Dec 6 21:58:16 2025 +0100
mbedtls: gracefully exit if certificate file is NULL
Signed-off-by: Steffan Karger <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1419
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34864.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#2) to the change originally created by syzzer. ( http://gerrit.openvpn.net/c/openvpn/+/1419?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
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.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1419
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34864.html
---
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/2
src/openvpn/ssl_mbedtls.c +5 -1
@@ -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 unsigned 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=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0d592d9d0c7ead296869f933c206c5d55e6cbed1
Gerrit-Change-Number: 1419
Gerrit-PatchSet: 2
Gerrit-Owner: syzzer <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1419?usp=email )
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.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1419
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34864.html
---
M src/openvpn/ssl_mbedtls.c
1 file changed, 5 insertions(+), 1 deletion(-)
src/openvpn/ssl_mbedtls.c +5 -1
@@ -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 unsigned 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=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0d592d9d0c7ead296869f933c206c5d55e6cbed1
Gerrit-Change-Number: 1419
Gerrit-PatchSet: 2
Gerrit-Owner: syzzer <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>