[#3375] Correctly calculate the endOffset when wrap multiple ByteBuffer

Motivation:

We failed to correctly calculate the endOffset when wrap multiple ByteBuffer and so not wrapped everything when an offset > 0 is used.

Modifications:

Correctly calculate endOffset.

Result:

All ByteBuffers are correctly wrapped when offset > 0.
This commit is contained in:
Norman Maurer 2015-01-25 20:33:07 +01:00
parent 4bafb4f95b
commit 4619e88a7b

View File

@ -427,7 +427,8 @@ public final class OpenSslEngine extends SSLEngine {
// There was no pending data in the network BIO -- encrypt any application data // There was no pending data in the network BIO -- encrypt any application data
int bytesConsumed = 0; 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]; final ByteBuffer src = srcs[i];
while (src.hasRemaining()) { while (src.hasRemaining()) {