diff --git a/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksCmdResponse.java b/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksCmdResponse.java index b38db62121..c918c3182a 100644 --- a/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksCmdResponse.java +++ b/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksCmdResponse.java @@ -90,8 +90,8 @@ public final class SocksCmdResponse extends SocksResponse { } host = IDN.toASCII(host); } - if (port <= 0 && port >= 65536) { - throw new IllegalArgumentException(port + " is not in bounds 0 < x < 65536"); + if (port < 0 || port > 65535) { + throw new IllegalArgumentException(port + " is not in bounds 0 <= x <= 65535"); } this.cmdStatus = cmdStatus; this.addressType = addressType;