Commit f62c7339 authored by Sergey Lyubka's avatar Sergey Lyubka

Merge pull request #176 from codyhanson/portRangeFix

Added bounds checking for listening_ports.
parents dee97cbf 94050d44
...@@ -4291,6 +4291,8 @@ static int parse_port_string(const struct vec *vec, struct socket *so) { ...@@ -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 || } else if (sscanf(vec->ptr, "%d%n", &port, &len) != 1 ||
len <= 0 || len <= 0 ||
len > (int) vec->len || len > (int) vec->len ||
port < 1 ||
port > 65535 ||
(vec->ptr[len] && vec->ptr[len] != 's' && (vec->ptr[len] && vec->ptr[len] != 's' &&
vec->ptr[len] != 'r' && vec->ptr[len] != ',')) { vec->ptr[len] != 'r' && vec->ptr[len] != ',')) {
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment