summaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-12-10 15:54:38 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2018-12-10 15:54:38 +0100
commitb2c9b3500cd2aae8b6d5eab5863b0fb72dedbefd (patch)
treeba296ac06c30d07fb4db53fe572a126256adf545 /app
parentf60d26c4bf199dc377c152bfda7370858781312c (diff)
Do not allow for an empty port in endpoint
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/com/wireguard/config/InetEndpoint.java2
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.