Message.readBytes(): Fail fast if length is too large

This commit is contained in:
Oscar Guindzberg
2018-05-08 14:10:31 -03:00
committed by Andreas Schildbach
parent 26adf68948
commit 694955c98b

View File

@@ -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 {