mirror of
https://github.com/lammertb/libhttp.git
synced 2026-01-28 20:00:52 +03:00
Added bounds checking for listening_ports.
Needs to be a valid TCP port number, and not less than 1 or greater than 65535
This commit is contained in:
@@ -4291,6 +4291,8 @@ static int parse_port_string(const struct vec *vec, struct socket *so) {
|
||||
} else if (sscanf(vec->ptr, "%d%n", &port, &len) != 1 ||
|
||||
len <= 0 ||
|
||||
len > (int) vec->len ||
|
||||
port < 1 ||
|
||||
port > 65535 ||
|
||||
(vec->ptr[len] && vec->ptr[len] != 's' &&
|
||||
vec->ptr[len] != 'r' && vec->ptr[len] != ',')) {
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user