From 290cc3f8d50435a6ed5f2cb1ecd9056dadcc4783 Mon Sep 17 00:00:00 2001 From: Selva Nair Date: Tue, 29 Nov 2016 20:53:14 -0500 Subject: [PATCH] When parsing '--setenv opt xx ..' make sure a third parameter is present When no parameters are present, set it to "setenv opt" to trigger a descriptive error message. And, thus get rid of the pesky NULL pointer dereferencing. Trac: #779 Signed-off-by: Selva Nair Acked-by: Gert Doering Message-Id: <1480470794-6349-1-git-send-email-selva.nair@gmail.com> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13311.html Signed-off-by: Gert Doering (cherry picked from commit 997795353916ffcb413a2da02dc7f210fd621954) --- src/openvpn/options.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/openvpn/options.c b/src/openvpn/options.c index c402b535c..a9419d4d9 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -4215,6 +4215,8 @@ add_option (struct options *options, */ if (streq (p[0], "setenv") && p[1] && streq (p[1], "opt") && !(permission_mask & OPT_P_PULL_MODE)) { + if (!p[2]) + p[2] = "setenv opt"; /* will trigger an error that includes setenv opt */ p += 2; msglevel_fc = M_WARN; } -- 2.47.2