From aa4b7926d31f3503f692a710959f1825c444d5cb Mon Sep 17 00:00:00 2001 From: Alemiz Date: Fri, 12 Jul 2024 13:58:46 +0200 Subject: [PATCH] Check for lower than 0 in EntityData limit --- .../protocol/bedrock/codec/v291/BedrockCodecHelper_v291.java | 2 +- .../protocol/bedrock/codec/v361/BedrockCodecHelper_v361.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v291/BedrockCodecHelper_v291.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v291/BedrockCodecHelper_v291.java index 3921d4b19..203b04ec0 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v291/BedrockCodecHelper_v291.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v291/BedrockCodecHelper_v291.java @@ -226,7 +226,7 @@ public void readEntityData(ByteBuf buffer, EntityDataMap entityDataMap) { checkNotNull(entityDataMap, "entityDataDictionary"); int length = VarInts.readUnsignedInt(buffer); - checkArgument(this.encodingSettings.maxListSize() == 0 || length <= this.encodingSettings.maxListSize(), "Entity data size is too big: %s", length); + checkArgument(this.encodingSettings.maxListSize() <= 0 || length <= this.encodingSettings.maxListSize(), "Entity data size is too big: %s", length); for (int i = 0; i < length; i++) { int id = VarInts.readUnsignedInt(buffer); diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v361/BedrockCodecHelper_v361.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v361/BedrockCodecHelper_v361.java index 5723fb67e..12fbfd1e3 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v361/BedrockCodecHelper_v361.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v361/BedrockCodecHelper_v361.java @@ -32,7 +32,7 @@ public void readEntityData(ByteBuf buffer, EntityDataMap entityDataMap) { checkNotNull(entityDataMap, "entityDataDictionary"); int length = VarInts.readUnsignedInt(buffer); - checkArgument(this.encodingSettings.maxListSize() == 0 || length <= this.encodingSettings.maxListSize(), "Entity data size is too big: %s", length); + checkArgument(this.encodingSettings.maxListSize() <= 0 || length <= this.encodingSettings.maxListSize(), "Entity data size is too big: %s", length); for (int i = 0; i < length; i++) { int id = VarInts.readUnsignedInt(buffer);