From abd9dd91a948943e40cc29bcd3d7fa2522d9682e Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Wed, 9 Sep 2009 00:06:37 +1200 Subject: [PATCH] Bug 2215: config file line length limit --- src/ConfigParser.cc | 4 ++-- src/ConfigParser.h | 13 +++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) 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 { -- 2.47.2