From 4baec3ee10b8d6826d5f076a9832a92a5cfe3676 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Thu, 10 Dec 2015 13:37:10 +0100 Subject: [PATCH] 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 --- src/openvpn/options.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 36290a015..c70a9b634 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -3813,7 +3813,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; @@ -3831,6 +3831,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; -- 2.47.2