]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: server: make sure pool-max-conn is >= -1
authorWilly Tarreau <w@1wt.eu>
Wed, 23 Jan 2019 09:39:27 +0000 (10:39 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 24 Jan 2019 15:31:56 +0000 (16:31 +0100)
The keyword parser doesn't check the value range, but supported values are
-1 and positive values, thus we should check it.

This can be backported to 1.9.

src/server.c

index 7fbe558c5d8c58bf5f98f2c8c339289b11bb3b5f..5b95e83a0fe2c073c9ef6637f4ee5bf49e051f4e 100644 (file)
@@ -389,7 +389,12 @@ static int srv_parse_pool_max_conn(char **args, int *cur_arg, struct proxy *curp
                memprintf(err, "'%s' expects <value> as argument.\n", args[*cur_arg]);
                return ERR_ALERT | ERR_FATAL;
        }
+
        newsrv->max_idle_conns = atoi(arg);
+       if ((int)newsrv->max_idle_conns < -1) {
+               memprintf(err, "'%s' must be >= -1", args[*cur_arg]);
+               return ERR_ALERT | ERR_FATAL;
+       }
 
        return 0;
 }