From 42677f82a6d7aa04d2a2d219c5e92223ace06c76 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Tue, 24 Feb 2015 10:59:49 +0100 Subject: [PATCH] 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 --- .../src/main/java/io/netty/channel/epoll/Native.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/transport-native-epoll/src/main/java/io/netty/channel/epoll/Native.java b/transport-native-epoll/src/main/java/io/netty/channel/epoll/Native.java index 46f3b56838..84c1622444 100644 --- a/transport-native-epoll/src/main/java/io/netty/channel/epoll/Native.java +++ b/transport-native-epoll/src/main/java/io/netty/channel/epoll/Native.java @@ -473,7 +473,7 @@ final class Native { static InetSocketAddress address(byte[] addr, int offset, int len) { // 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; try { @@ -494,7 +494,7 @@ final class Native { case 24: byte[] ipv6 = new byte[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); break; default: