Skip to content

Commit

Permalink
Correctly handle SocksCmdResponse. Related to netty#2428
Browse files Browse the repository at this point in the history
Motivation:
Ports range check is not correct

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

Result:
Correct validation
  • Loading branch information
Norman Maurer committed Apr 30, 2014
1 parent 9707eba commit 79fc0d2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ public SocksCmdResponse(SocksCmdStatus cmdStatus, SocksAddressType addressType,
}
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;
Expand Down

0 comments on commit 79fc0d2

Please sign in to comment.