]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
wg-quick: android: use right regex for host-vs-IP
authorJason A. Donenfeld <Jason@zx2c4.com>
Tue, 10 May 2022 10:40:49 +0000 (12:40 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Tue, 10 May 2022 10:40:49 +0000 (12:40 +0200)
Looks like the "is valid ifname" regex was copy and pasted from
wg-quick.bash instead of the "is valid IP" regex.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
src/wg-quick/android.c

index a5a789ad12a5b663bf4e3b74cdadb838a66b8289..1263ee416ada9d5dc1fe7e5dcf97b82300ed4c4d 100644 (file)
@@ -855,7 +855,7 @@ static void set_dnses(unsigned int netid, const char *dnses)
        if (!len)
                return;
 
-       xregcomp(&regex_ipnothost, "^[a-zA-Z0-9_=+.-]{1,15}$", REG_EXTENDED | REG_NOSUB);
+       xregcomp(&regex_ipnothost, "(^[0-9.]+$)|(^.*:.*$)", REG_EXTENDED | REG_NOSUB);
        for (char *dns = strtok(mutable, ", \t\n"); dns; dns = strtok(NULL, ", \t\n")) {
                if (strchr(dns, '\'') || strchr(dns, '\\'))
                        continue;