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