mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
BUG/MINOR: conf: "listener id" expects integer, but its not checked
The listener id was converted with a simple atol, so conversion error are unchecked. This patch uses strtol and checks the conversion status.
This commit is contained in:
parent
e83345df1b
commit
e7fe8eb889
@ -646,6 +646,7 @@ static int bind_parse_id(char **args, int cur_arg, struct proxy *px, struct bind
|
||||
{
|
||||
struct eb32_node *node;
|
||||
struct listener *l, *new;
|
||||
char *error;
|
||||
|
||||
if (conf->listeners.n != conf->listeners.p) {
|
||||
memprintf(err, "'%s' can only be used with a single socket", args[cur_arg]);
|
||||
@ -658,7 +659,11 @@ static int bind_parse_id(char **args, int cur_arg, struct proxy *px, struct bind
|
||||
}
|
||||
|
||||
new = LIST_NEXT(&conf->listeners, struct listener *, by_bind);
|
||||
new->luid = atol(args[cur_arg + 1]);
|
||||
new->luid = strtol(args[cur_arg + 1], &error, 10);
|
||||
if (*error != '\0') {
|
||||
memprintf(err, "'%s' : expects an integer argument, found '%s'", args[cur_arg], args[cur_arg + 1]);
|
||||
return ERR_ALERT | ERR_FATAL;
|
||||
}
|
||||
new->conf.id.key = new->luid;
|
||||
|
||||
if (new->luid <= 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user