diff --git a/handler/src/main/java/io/netty/handler/ssl/OpenSslEngine.java b/handler/src/main/java/io/netty/handler/ssl/OpenSslEngine.java index a42d0ed047..afcaf09e38 100644 --- a/handler/src/main/java/io/netty/handler/ssl/OpenSslEngine.java +++ b/handler/src/main/java/io/netty/handler/ssl/OpenSslEngine.java @@ -427,7 +427,8 @@ public final class OpenSslEngine extends SSLEngine { // There was no pending data in the network BIO -- encrypt any application data int bytesConsumed = 0; - for (int i = offset; i < length; ++ i) { + int endOffset = offset + length; + for (int i = offset; i < endOffset; ++ i) { final ByteBuffer src = srcs[i]; while (src.hasRemaining()) {