Do not allow for an empty port in endpoint

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2018-12-10 15:54:38 +01:00
parent f60d26c4bf
commit b2c9b3500c

View File

@ -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.