ARTEMIS-1482 Add back check for SimpleString

This commit is contained in:
Martyn Taylor 2018-08-08 16:33:11 +01:00 committed by Clebert Suconic
parent 3d2eadfb8a
commit 985d1e1fcb
1 changed files with 3 additions and 0 deletions

View File

@ -179,6 +179,9 @@ public final class SimpleString implements CharSequence, Serializable, Comparabl
} }
public static SimpleString readSimpleString(final ByteBuf buffer, final int length) { public static SimpleString readSimpleString(final ByteBuf buffer, final int length) {
if (length > buffer.readableBytes()) {
throw new IndexOutOfBoundsException();
}
byte[] data = new byte[length]; byte[] data = new byte[length];
buffer.readBytes(data); buffer.readBytes(data);
return new SimpleString(data); return new SimpleString(data);