-
Type:
Bug
-
Resolution: Duplicate
-
Priority:
P4
-
None
-
Affects Version/s: 8, 11, 17
-
Component/s: security-libs
ADDITIONAL SYSTEM INFORMATION :
This is a documentation issue
A DESCRIPTION OF THE PROBLEM :
The sample code for handling buffer underflow during SSLEngine.wrap references the wrong buffer. It should reference "src" instead of "dst". I have annotated the snippet below:
BUFFER_UNDERFLOW:
int netSize = engine.getSession().getPacketBufferSize();
// Resize buffer if needed.
if (netSize > dst.capacity()) { ----> this should be src.capacity()
ByteBuffer b = ByteBuffer.allocate(netSize);
src.flip();
b.put(src);
src = b;
}
// Obtain more inbound network data for src,
// then retry the operation.
break;
This is a documentation issue
A DESCRIPTION OF THE PROBLEM :
The sample code for handling buffer underflow during SSLEngine.wrap references the wrong buffer. It should reference "src" instead of "dst". I have annotated the snippet below:
BUFFER_UNDERFLOW:
int netSize = engine.getSession().getPacketBufferSize();
// Resize buffer if needed.
if (netSize > dst.capacity()) { ----> this should be src.capacity()
ByteBuffer b = ByteBuffer.allocate(netSize);
src.flip();
b.put(src);
src = b;
}
// Obtain more inbound network data for src,
// then retry the operation.
break;
- duplicates
-
JDK-8203614 Java API SSLEngine example code needs correction
-
- Closed
-