Paper/Spigot-Server-Patches/0209-Fix-exploit-that-allowed-colored-signs-to-be-created.patch
Aikar 7358bf02f3
[Auto] Updated Upstream (CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
3eb7236e4 SPIGOT-6217: Missed PlayerEditBookEvent when editing books

Spigot Changes:
37d799b2 SPIGOT-6218: Player.spigot().sendMessage(UUID, BaseComponent...) does not work
2020-11-04 03:57:07 -05:00

32 Zeilen
2.0 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 30bdf7dff8fc611677b95918574d4ad42ddf1c6c..7dd7289941253991d0a2aa22f9b058c116c14e82 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2633,7 +2633,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
String[] lines = new String[4];
for (int i = 0; i < list.size(); ++i) {
- lines[i] = EnumChatFormat.a(new ChatComponentText(EnumChatFormat.a((String) list.get(i))).getString());
+ 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 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();