mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-06 16:37:38 +01:00
Checking that payload length is positive on packets reading (#1211)
This commit is contained in:
parent
4884051c6a
commit
0c6599fee6
@ -172,6 +172,9 @@ public final class PacketUtils {
|
||||
if (compressed) {
|
||||
final int dataLength = readBuffer.readVarInt();
|
||||
final int payloadLength = packetLength - (readBuffer.readerOffset() - readerStart);
|
||||
if (payloadLength < 0) {
|
||||
throw new DataFormatException("Negative payload length " + payloadLength);
|
||||
}
|
||||
if (dataLength == 0) {
|
||||
// Data is too small to be compressed, payload is following
|
||||
decompressedSize = payloadLength;
|
||||
|
Loading…
Reference in New Issue
Block a user