wg-quick: android: do not choke on empty allowed-ips

Reported-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2018-11-11 22:11:56 -05:00
parent 1aa8364b17
commit 7e106d3a4c

View file

@ -512,9 +512,12 @@ static void set_routes(const char *iface, unsigned int netid)
if (!start)
continue;
++start;
for (char *allowedip = strtok(start, " \n"); allowedip; allowedip = strtok(NULL, " \n"))
for (char *allowedip = strtok(start, " \n"); allowedip; allowedip = strtok(NULL, " \n")) {
if (!strcmp(allowedip, "(none)"))
continue;
add_route(iface, netid, allowedip);
}
}
}
static void maybe_block_ipv6(const char *iface)