From 68f5aff87155774fbb591c08877072c1d2e1adf3 Mon Sep 17 00:00:00 2001 From: Alemiz Date: Mon, 21 Oct 2024 17:48:05 +0200 Subject: [PATCH] Check for limit disabled --- .../v618/serializer/ResourcePacksInfoSerializer_v618.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v618/serializer/ResourcePacksInfoSerializer_v618.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v618/serializer/ResourcePacksInfoSerializer_v618.java index 9ca065954..388091229 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v618/serializer/ResourcePacksInfoSerializer_v618.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v618/serializer/ResourcePacksInfoSerializer_v618.java @@ -13,6 +13,8 @@ import java.util.HashMap; import java.util.Map; +import static org.cloudburstmc.protocol.common.util.Preconditions.checkArgument; + @RequiredArgsConstructor(access = AccessLevel.PROTECTED) public class ResourcePacksInfoSerializer_v618 extends ResourcePacksInfoSerializer_v448 { private static final InternalLogger log = InternalLoggerFactory.getInstance(ResourcePacksInfoSerializer_v618.class); @@ -54,9 +56,7 @@ protected void writeCDNEntries(ByteBuf buffer, ResourcePacksInfoPacket packet, B protected void readCDNEntries(ByteBuf buffer, ResourcePacksInfoPacket packet, BedrockCodecHelper helper) { int size = VarInts.readUnsignedInt(buffer); - if (size > helper.getEncodingSettings().maxListSize()) { - throw new IllegalArgumentException("CDN entries size exceeds maximum size " + size); - } + checkArgument(helper.getEncodingSettings().maxListSize() <= 0 || size <= helper.getEncodingSettings().maxListSize(), "CDN entries size is too big: %s", size); if (size == 0 || packet.getResourcePackInfos().isEmpty()) { return;