Fix regression introduced by 20e32f62ecc90079d1fe940cc70683617a4b3591
Motivation: Because of a regression sometimes accept could produce an IllegalArgumentException Modifications: Correctly respect offset when decode port and scope id. Result: No more IllegalArgumentException
This commit is contained in:
parent
960a486f13
commit
42677f82a6
@ -473,7 +473,7 @@ final class Native {
|
|||||||
|
|
||||||
static InetSocketAddress address(byte[] addr, int offset, int len) {
|
static InetSocketAddress address(byte[] addr, int offset, int len) {
|
||||||
// The last 4 bytes are always the port
|
// The last 4 bytes are always the port
|
||||||
final int port = decodeInt(addr, len - 4);
|
final int port = decodeInt(addr, offset + len - 4);
|
||||||
final InetAddress address;
|
final InetAddress address;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -494,7 +494,7 @@ final class Native {
|
|||||||
case 24:
|
case 24:
|
||||||
byte[] ipv6 = new byte[16];
|
byte[] ipv6 = new byte[16];
|
||||||
System.arraycopy(addr, offset, ipv6, 0, 16);
|
System.arraycopy(addr, offset, ipv6, 0, 16);
|
||||||
int scopeId = decodeInt(addr, len - 8);
|
int scopeId = decodeInt(addr, offset + len - 8);
|
||||||
address = Inet6Address.getByAddress(null, ipv6, scopeId);
|
address = Inet6Address.getByAddress(null, ipv6, scopeId);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user