[Openvpn-devel] Fix segfault when no --config argument is given

Message ID 20220722134652.2446598-1-arne@rfc2549.org
State Accepted
Headers show
Series [Openvpn-devel] Fix segfault when no --config argument is given | expand

Commit Message

Arne Schwabe July 22, 2022, 3:46 a.m. UTC
Commit 4df5003 introduced a check against options->config but
did not ensure that this varialbe is non-null.
---
 src/openvpn/options.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Gert Doering July 22, 2022, 4:29 a.m. UTC | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

Tested with and without --config, AND with "make check"!

Your patch has been applied to the master branch.

commit 6a0fcced7c44ae03a15e2ee28cd1867171c2c988
Author: Arne Schwabe
Date:   Fri Jul 22 15:46:52 2022 +0200

     Fix segfault when no --config argument is given

     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20220722134652.2446598-1-arne@rfc2549.org>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24722.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 b9de2e5d0..a68a2991f 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -3680,7 +3680,7 @@  options_postprocess_mutate(struct options *o, struct env_set *es)
         o->verify_hash_no_ca = true;
     }
 
-    if (streq(o->config, "stdin") && o->remap_sigusr1 == SIGHUP)
+    if (o->config && streq(o->config, "stdin") && o->remap_sigusr1 == SIGHUP)
     {
         msg(M_USAGE, "Options 'config stdin' and 'remap-usr1 SIGHUP' are "
             "incompatible with each other.");