Refuse to convert legacy messages over 1k characters (#62)

This commit is contained in:
Allink 2022-08-18 03:45:44 +01:00 committed by GitHub
parent c48a56ac01
commit 3a4b3ffd34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 1 deletions

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Validate block entity tag query positions
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index d6aa46443b0ec9b02259222d8ee9a7ff0cec4ae7..dd80826c8ce1a9bb479eea383d84b71c8756a341 100644 index a102586b42ac408a3f655f7c0d069ab0990ec7fc..dbf982c85ff361184a34b462bec331ac5b1a472c 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1252,7 +1252,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1252,7 +1252,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser

View File

@ -0,0 +1,22 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Allink <arclicious@vivaldi.net>
Date: Tue, 16 Aug 2022 18:14:16 +0100
Subject: [PATCH] Refuse to convert legacy messages over 1k characters
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
index 26d43c229caf9f8504af7071c3a61ec6da7e27ec..ecceb3fc7f822d826b4a789fe72a8cd08e90d60e 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
@@ -198,6 +198,11 @@ public final class CraftChatMessage {
}
public static Component[] fromString(String message, boolean keepNewlines, boolean plain) {
+ // Scissors start - Refuse to convert legacy messages over 1k characters
+ if (message.length() > 1_000) {
+ return new Component[]{TextComponent.EMPTY};
+ }
+ // Scissors end
return new StringMessage(message, keepNewlines, plain).getOutput();
}