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 <contact@joshua.hu>
Found-by: ZeroPath (https://zeropath.com/)
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1419
Message-Id: <
20251206205829.27254-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34864.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
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