]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Detect config lines that are too long and give a warning/error
authorArne Schwabe <arne@rfc2549.org>
Thu, 10 Dec 2015 12:37:10 +0000 (13:37 +0100)
committerGert Doering <gert@greenie.muc.de>
Thu, 10 Dec 2015 16:35:13 +0000 (17:35 +0100)
Trac #631

Acked-by: Gert Doering <gert@greenie.muc.de>
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 <gert@greenie.muc.de>
(cherry picked from commit 4baec3ee10b8d6826d5f076a9832a92a5cfe3676)

src/openvpn/options.c

index f609aa63e030b91012ea64733a0ecd13bbbc7c96..3948eebf7b536379c90291bdaed17d63b4ddf7d3 100644 (file)
@@ -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;