From: Arne Schwabe Date: Thu, 10 Dec 2015 12:37:10 +0000 (+0100) Subject: Detect config lines that are too long and give a warning/error X-Git-Tag: v2.3.9~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=305c16c28d0ce7bc48c6e0abb18653241ddb910b;p=thirdparty%2Fopenvpn.git Detect config lines that are too long and give a warning/error Trac #631 Acked-by: Gert Doering Message-Id: <1449751030-10703-1-git-send-email-arne@rfc2549.org> URL: http://article.gmane.org/gmane.network.openvpn.devel/10723 Signed-off-by: Gert Doering (cherry picked from commit 4baec3ee10b8d6826d5f076a9832a92a5cfe3676) --- diff --git a/src/openvpn/options.c b/src/openvpn/options.c index f609aa63e..3948eebf7 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -3869,7 +3869,7 @@ read_config_file (struct options *options, const int max_recursive_levels = 10; FILE *fp; int line_num; - char line[OPTION_LINE_SIZE]; + char line[OPTION_LINE_SIZE+1]; char *p[MAX_PARMS]; ++level; @@ -3887,6 +3887,10 @@ read_config_file (struct options *options, int offset = 0; CLEAR (p); ++line_num; + if (strlen(line) == OPTION_LINE_SIZE) + msg (msglevel, "In %s:%d: Maximum optione line length (%d) exceeded, line starts with %s", + file, line_num, OPTION_LINE_SIZE, line); + /* Ignore UTF-8 BOM at start of stream */ if (line_num == 1 && strncmp (line, "\xEF\xBB\xBF", 3) == 0) offset = 3;