diff --git a/common/src/main/java/org/conscrypt/OpenSSLEngineSocketImpl.java b/common/src/main/java/org/conscrypt/OpenSSLEngineSocketImpl.java index df0ac6832..a8bfc60dd 100644 --- a/common/src/main/java/org/conscrypt/OpenSSLEngineSocketImpl.java +++ b/common/src/main/java/org/conscrypt/OpenSSLEngineSocketImpl.java @@ -387,7 +387,7 @@ private void write(ByteBuffer buffer) throws IOException { } } else { // Target is a heap buffer. - socketOutputStream.write(target.array(), 0, target.position()); + socketOutputStream.write(target.array(), 0, target.limit()); } if (engineResult.getHandshakeStatus() == HandshakeStatus.FINISHED) { completeHandshake();