From 67fb3b70a4e27d3babd3eb603139dd2dcf046755 Mon Sep 17 00:00:00 2001 From: KoutaChan <76502083+KoutaChan@users.noreply.github.com> Date: Sun, 1 Sep 2024 06:11:54 +0900 Subject: [PATCH] Increase readComponent string size limit to 262,143 for 1.13-1.20.2 (#1409) --- .../proxy/protocol/packet/chat/ComponentHolder.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/ComponentHolder.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/ComponentHolder.java index d833f1300..a4d914634 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/ComponentHolder.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/ComponentHolder.java @@ -54,6 +54,7 @@ import java.util.Map; public class ComponentHolder { private static final Logger logger = LogManager.getLogger(ComponentHolder.class); + public static final int DEFAULT_MAX_STRING_SIZE = 262143; private final ProtocolVersion version; private @MonotonicNonNull Component component; @@ -282,6 +283,8 @@ public class ComponentHolder { if (version.noLessThan(ProtocolVersion.MINECRAFT_1_20_3)) { return new ComponentHolder(version, ProtocolUtils.readBinaryTag(buf, version, BinaryTagIO.reader())); + } else if (version.noLessThan(ProtocolVersion.MINECRAFT_1_13)) { + return new ComponentHolder(version, ProtocolUtils.readString(buf, DEFAULT_MAX_STRING_SIZE)); } else { return new ComponentHolder(version, ProtocolUtils.readString(buf)); }