mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-19 18:01:00 +01:00
BUG/MEDIUM: tools: fix bad character handling in str2sa_range()
Commit d4448bc8 brought support for parsing port ranges, but invalid characters are not properly handled and can result in a crash while parsing the configuration if an invalid character is present in the port, because the return value is set to NULL then dereferenced.
This commit is contained in:
parent
0dbbf317e6
commit
e4c58c89f6
@ -679,8 +679,10 @@ struct sockaddr_storage *str2sa_range(const char *str, int *low, int *high)
|
|||||||
porth = atoi(port1 + 1);
|
porth = atoi(port1 + 1);
|
||||||
porta = porth;
|
porta = porth;
|
||||||
}
|
}
|
||||||
else if (*port1) /* other any unexpected char */
|
else if (*port1) { /* other any unexpected char */
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
set_host_port(ret, porta);
|
set_host_port(ret, porta);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user