PaperMC/Spigot-Server-Patches/0209-Fix-exploit-that-allowed-colored-signs-to-be-created.patch
Riley Park 4e958e229f
We're going on an Adventure! (#4842)
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: zml <zml@stellardrift.ca>
Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
2021-02-21 20:45:33 +01:00

31 lines
2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: 0x22 <0x22@futureclient.net>
Date: Thu, 26 Apr 2018 04:41:11 -0400
Subject: [PATCH] Fix exploit that allowed colored signs to be created
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index fa4ae84f7ed03da24d89268c4c5664430d9e332b..a6a9ee8f34a61fbabfb1643b41cfb5e3a72cdf78 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2630,7 +2630,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
List<net.kyori.adventure.text.Component> lines = new java.util.ArrayList<>();
for (int i = 0; i < list.size(); ++i) {
- lines.add(net.kyori.adventure.text.Component.text(list.get(i)));
+ lines.add(net.kyori.adventure.text.Component.text(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.at(worldserver, blockposition), this.getPlayer(), 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 9663e8c10662c9660964afda62d8a65812fae69d..470690dbe19db1622eca44f6801ece37d7ad7426 100644
--- a/src/main/java/net/minecraft/server/SharedConstants.java
+++ b/src/main/java/net/minecraft/server/SharedConstants.java
@@ -19,6 +19,7 @@ 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();