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
1 changed files with 4 additions and 1 deletions

View File

@ -512,8 +512,11 @@ 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);
}
}
}