]> 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:34:44 +0000 (17:34 +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>
src/openvpn/options.c

index 36290a01546233bccbaaedc40117361a77cfe5b5..c70a9b634b991687121ec17353547af444ca931e 100644 (file)
@@ -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;