From 0b2f49cb81434d82a210df6a1381552fb4dfa0d1 Mon Sep 17 00:00:00 2001 From: Mariell Date: Tue, 3 Nov 2020 22:30:15 +0100 Subject: [PATCH] OBFHELPERS (#4733) --- ...that-allowed-colored-signs-to-be-created.patch | 15 +++++++++++++-- .../Limit-Client-Sign-length-more.patch | 5 ++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Spigot-Server-Patches/Fix-exploit-that-allowed-colored-signs-to-be-created.patch b/Spigot-Server-Patches/Fix-exploit-that-allowed-colored-signs-to-be-created.patch index 6d110f2440..f1f7e769b1 100644 --- a/Spigot-Server-Patches/Fix-exploit-that-allowed-colored-signs-to-be-created.patch +++ b/Spigot-Server-Patches/Fix-exploit-that-allowed-colored-signs-to-be-created.patch @@ -13,8 +13,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 for (int i = 0; i < list.size(); ++i) { - lines[i] = EnumChatFormat.a(new ChatComponentText(EnumChatFormat.a((String) list.get(i))).getString()); -+ // Paper TODO(Proximyst): Add obfhelper when 1.16.4 runs -+ lines[i] = SharedConstants.a(list.get(i)); // Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created. ++ lines[i] = SharedConstants.filterAllowedChatCharacters(list.get(i)); // Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created. } SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines); this.server.getPluginManager().callEvent(event); +diff --git a/src/main/java/net/minecraft/server/SharedConstants.java b/src/main/java/net/minecraft/server/SharedConstants.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/SharedConstants.java ++++ b/src/main/java/net/minecraft/server/SharedConstants.java +@@ -0,0 +0,0 @@ public class SharedConstants { + return c0 != 167 && c0 >= ' ' && c0 != 127; + } + ++ public static String filterAllowedChatCharacters(String input) { return a(input); } // Paper - OBFHELPER + public static String a(String s) { + StringBuilder stringbuilder = new StringBuilder(); + char[] achar = s.toCharArray(); diff --git a/Spigot-Server-Patches/Limit-Client-Sign-length-more.patch b/Spigot-Server-Patches/Limit-Client-Sign-length-more.patch index 6b0c013b13..ac59e4aa83 100644 --- a/Spigot-Server-Patches/Limit-Client-Sign-length-more.patch +++ b/Spigot-Server-Patches/Limit-Client-Sign-length-more.patch @@ -37,6 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 String[] lines = new String[4]; for (int i = 0; i < list.size(); ++i) { +- lines[i] = SharedConstants.filterAllowedChatCharacters(list.get(i)); // Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created. + // Paper start - cap line length - modified clients can send longer data than normal + String currentLine = list.get(i); + if (MAX_SIGN_LINE_LENGTH > 0 && currentLine.length() > MAX_SIGN_LINE_LENGTH) { @@ -47,9 +48,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + // Paper end - // Paper TODO(Proximyst): Add obfhelper when 1.16.4 runs -- lines[i] = SharedConstants.a(list.get(i)); // Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created. -+ lines[i] = SharedConstants.a(currentLine); // Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created. ++ lines[i] = SharedConstants.filterAllowedChatCharacters(currentLine); // Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created. } SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines); this.server.getPluginManager().callEvent(event);