Skip to content

Commit

Permalink
Increase readComponent string size limit to 262,143 for 1.13-1.20.2 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
KoutaChan authored Aug 31, 2024
1 parent 6100e67 commit 67fb3b7
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@

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;
Expand Down Expand Up @@ -282,6 +283,8 @@ public static ComponentHolder read(ByteBuf buf, ProtocolVersion version) {
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));
}
Expand Down

0 comments on commit 67fb3b7

Please sign in to comment.