From: Amos Jeffries Date: Thu, 24 Sep 2009 08:47:07 +0000 (+1200) Subject: Bug 2215: config file line length limit X-Git-Tag: SQUID_3_1_0_14~20 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6ed54ca7ad355e64c075c01d46ca4f17e30892b1;p=thirdparty%2Fsquid.git Bug 2215: config file line length limit --- diff --git a/src/ConfigParser.cc b/src/ConfigParser.cc index 9853875c3c..2453344c55 100644 --- a/src/ConfigParser.cc +++ b/src/ConfigParser.cc @@ -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; diff --git a/src/ConfigParser.h b/src/ConfigParser.h index 2c466ed86f..4d5a25ba6a 100644 --- a/src/ConfigParser.h +++ b/src/ConfigParser.h @@ -38,7 +38,17 @@ #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 {