]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: config: check that tune.bufsize is always positive
authorWilly Tarreau <w@1wt.eu>
Mon, 28 Sep 2015 11:49:53 +0000 (13:49 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 28 Sep 2015 11:59:38 +0000 (13:59 +0200)
We must not accept negative values for tune.bufsize as they will only
result in crashing the process during the parsing.

src/cfgparse.c

index d5a6f04f7ddd45454b9c0eb1f292549a6d60c5bd..f7944c3aa41d569cd7da72593908970170f7b697 100644 (file)
@@ -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);