]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 2215: config file line length limit
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 8 Sep 2009 12:06:37 +0000 (00:06 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 8 Sep 2009 12:06:37 +0000 (00:06 +1200)
src/ConfigParser.cc
src/ConfigParser.h

index 9853875c3c8a570b9567388cfcc0eef17422eee3..2453344c55a27eefe8ba3443cf272be718269034 100644 (file)
@@ -51,7 +51,7 @@ ConfigParser::strtokFile(void)
     static FILE *wordFile = NULL;
 
     char *t, *fn;
-    LOCAL_ARRAY(char, buf, 256);
+    LOCAL_ARRAY(char, buf, CONFIG_LINE_LIMIT);
 
     do {
 
@@ -86,7 +86,7 @@ ConfigParser::strtokFile(void)
         }
 
         /* fromFile */
-        if (fgets(buf, 256, wordFile) == NULL) {
+        if (fgets(buf, CONFIG_LINE_LIMIT, wordFile) == NULL) {
             /* stop reading from file */
             fclose(wordFile);
             wordFile = NULL;
index 2c466ed86fc0a4045e1b3fef66adb503469e7a86..4d5a25ba6abdeca4ad4282f0a5343fd52409aaaa 100644 (file)
 
 #include "squid.h"
 
-/*
+/**
+ * Limit to how long any given config line may be.
+ * This affects squid.conf and all included files.
+ *
+ * Behaviour when setting larger than 2KB is unknown.
+ * The config parser read mechanism can cope, but the other systems
+ * receiving the data from its buffers on such lines may not.
+ */
+#define CONFIG_LINE_LIMIT      2048
+
+/**
  * A configuration file Parser. Instances of this class track
  * parsing state and perform tokenisation. Syntax is currently
  * taken care of outside this class.
@@ -48,7 +58,6 @@
  * in all of squid by reference. Instead the tokeniser only is
  * brought in.
  */
-
 class ConfigParser
 {