diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-12-10 15:54:38 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-12-10 15:54:38 +0100 |
commit | e69e84ae03b59496cdd9f462a203cbd0e408abcd (patch) | |
tree | ba296ac06c30d07fb4db53fe572a126256adf545 /app/src | |
parent | e168d095c226a3366c1040b7f3edc92d7b2957c3 (diff) |
Do not allow for an empty port in endpoint
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/com/wireguard/config/InetEndpoint.java | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/app/src/main/java/com/wireguard/config/InetEndpoint.java b/app/src/main/java/com/wireguard/config/InetEndpoint.java index 06d0ca80..962d97c6 100644 --- a/app/src/main/java/com/wireguard/config/InetEndpoint.java +++ b/app/src/main/java/com/wireguard/config/InetEndpoint.java @@ -51,6 +51,8 @@ public final class InetEndpoint { } catch (final URISyntaxException e) { throw new IllegalArgumentException(e); } + if (uri.getPort() < 0) + throw new IllegalArgumentException("An endpoint must specify a port (e.g. 51820)"); try { InetAddresses.parse(uri.getHost()); // Parsing ths host as a numeric address worked, so we don't need to do DNS lookups. |