From: Willy Tarreau Date: Mon, 28 Sep 2015 11:49:53 +0000 (+0200) Subject: BUG/MINOR: config: check that tune.bufsize is always positive X-Git-Tag: v1.6-dev6~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b69454570f52eec12fb10a0c1012b8915ad6575;p=thirdparty%2Fhaproxy.git BUG/MINOR: config: check that tune.bufsize is always positive We must not accept negative values for tune.bufsize as they will only result in crashing the process during the parsing. --- diff --git a/src/cfgparse.c b/src/cfgparse.c index d5a6f04f7d..f7944c3aa4 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -828,6 +828,11 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) goto out; } global.tune.bufsize = atol(args[1]); + if (global.tune.bufsize <= 0) { + Alert("parsing [%s:%d] : '%s' expects a positive integer argument.\n", file, linenum, args[0]); + err_code |= ERR_ALERT | ERR_FATAL; + goto out; + } if (global.tune.maxrewrite >= global.tune.bufsize / 2) global.tune.maxrewrite = global.tune.bufsize / 2; chunk_init(&trash, realloc(trash.str, global.tune.bufsize), global.tune.bufsize);