Correctly handle SocksCmdResponse. Related to #2428

Motivation:
Ports range check is not correct

Modification:
Allow port between 0 and 65535. 0 is wildcard / unknown port here

Result:
Correct validation
This commit is contained in:
Norman Maurer 2014-04-30 10:40:00 +02:00
parent e6783d173a
commit 82220b0987

View File

@ -90,8 +90,8 @@ public final class SocksCmdResponse extends SocksResponse {
} }
host = IDN.toASCII(host); host = IDN.toASCII(host);
} }
if (port <= 0 && port >= 65536) { if (port < 0 || port > 65535) {
throw new IllegalArgumentException(port + " is not in bounds 0 < x < 65536"); throw new IllegalArgumentException(port + " is not in bounds 0 <= x <= 65535");
} }
this.cmdStatus = cmdStatus; this.cmdStatus = cmdStatus;
this.addressType = addressType; this.addressType = addressType;