[Openvpn-devel,v1] Do not segfault on missing --dh in server config

Message ID 20250602152115.27130-1-gert@greenie.muc.de
State New
Headers show
Series [Openvpn-devel,v1] Do not segfault on missing --dh in server config | expand

Commit Message

Gert Doering June 2, 2025, 3:21 p.m. UTC
From: Frank Lichtenheld <frank@lichtenheld.com>

Change-Id: I0e13595c1057c680e1065eae84ca94b273ed9ca1
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
---

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/+/1037
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <gert@greenie.muc.de>

Comments

Gert Doering June 2, 2025, 3:30 p.m. UTC | #1
Apologies.

"The more trivial a patch looks, the more testing it warrants"...

Now *this* patch is rather trivial, and *have* verified that it, indeed,
makes a config "with no --dh in it" work with no segfault.

Your patch has been applied to the master branch.

commit 92b9cb5e0363a1c19b76a5a6e5f36c9891406590
Author: Frank Lichtenheld
Date:   Mon Jun 2 17:21:08 2025 +0200

     Do not segfault on missing --dh in server config

     Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20250602152115.27130-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31844.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index 0d648ba..b9708343 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -3698,7 +3698,7 @@ 
 
     if (o->tls_server)
     {
-        if (streq(o->dh_file, "none"))
+        if (o->dh_file && streq(o->dh_file, "none"))
         {
             o->dh_file = NULL;
         }