From: Selva Nair Date: Wed, 30 Nov 2016 01:53:14 +0000 (-0500) Subject: When parsing '--setenv opt xx ..' make sure a third parameter is present X-Git-Tag: v2.4_rc1~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=997795353916ffcb413a2da02dc7f210fd621954;p=thirdparty%2Fopenvpn.git 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 --- diff --git a/src/openvpn/options.c b/src/openvpn/options.c index a7a1f9a4c..eac802327 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -4407,6 +4407,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; }