1 commit 6e580b6e744011e87c337ebe2c082acfd5ca835a
2 Author: Christopher Faulet <cfaulet@haproxy.com>
3 Date: Tue Apr 30 14:03:56 2019 +0200
5 MINOR: config: Test validity of tune.maxaccept during the config parsing
7 Only -1 and positive integers from 0 to INT_MAX are accepted. An error is
8 triggered during the config parsing for any other values.
10 This patch may be backported to all supported versions.
12 (cherry picked from commit 6b02ab87348090efec73b1dd24f414239669f279)
13 Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
14 (cherry picked from commit 2bbc40f8bc9a52ba0d03b25270ac0129cca29bba)
15 Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
17 diff --git a/src/cfgparse.c b/src/cfgparse.c
18 index c178538b..8e325416 100644
21 @@ -789,6 +789,8 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
22 global.tune.maxpollevents = atol(args[1]);
24 else if (!strcmp(args[0], "tune.maxaccept")) {
27 if (alertif_too_many_args(1, file, linenum, args, &err_code))
29 if (global.tune.maxaccept != 0) {
30 @@ -801,7 +803,13 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
31 err_code |= ERR_ALERT | ERR_FATAL;
34 - global.tune.maxaccept = atol(args[1]);
35 + max = atol(args[1]);
36 + if (/*max < -1 || */max > INT_MAX) {
37 + ha_alert("parsing [%s:%d] : '%s' expects -1 or an integer from 0 to INT_MAX.\n", file, linenum, args[0]);
38 + err_code |= ERR_ALERT | ERR_FATAL;
41 + global.tune.maxaccept = max;
43 else if (!strcmp(args[0], "tune.chksize")) {
44 if (alertif_too_many_args(1, file, linenum, args, &err_code))