Do not allow for an empty port in endpoint
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
f60d26c4bf
commit
b2c9b3500c
@ -51,6 +51,8 @@ public final class InetEndpoint {
|
|||||||
} catch (final URISyntaxException e) {
|
} catch (final URISyntaxException e) {
|
||||||
throw new IllegalArgumentException(e);
|
throw new IllegalArgumentException(e);
|
||||||
}
|
}
|
||||||
|
if (uri.getPort() < 0)
|
||||||
|
throw new IllegalArgumentException("An endpoint must specify a port (e.g. 51820)");
|
||||||
try {
|
try {
|
||||||
InetAddresses.parse(uri.getHost());
|
InetAddresses.parse(uri.getHost());
|
||||||
// Parsing ths host as a numeric address worked, so we don't need to do DNS lookups.
|
// Parsing ths host as a numeric address worked, so we don't need to do DNS lookups.
|
||||||
|
Loading…
Reference in New Issue
Block a user