Message.readBytes(): Fail fast if length is too large
@@ -329,7 +329,7 @@ public abstract class Message {
}
protected byte[] readBytes(int length) throws ProtocolException {
- if (length > MAX_SIZE) {
+ if ((length > MAX_SIZE) || (cursor + length > payload.length)) {
throw new ProtocolException("Claimed value length too large: " + length);
}
try {
