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.3.14~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=290cc3f8d50435a6ed5f2cb1ecd9056dadcc4783;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 (cherry picked from commit 997795353916ffcb413a2da02dc7f210fd621954) --- 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; }