Waterfall/BungeeCord-Patches/0023-Validate-that-chat-messages-are-non-blank.patch
Shane Freeder 8050674c86
Updated Upstream (BungeeCord)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

BungeeCord Changes:
5467e3a8 Minecraft 1.19.3 support
2022-12-07 16:30:18 +00:00

34 lines
1.4 KiB
Diff

From 1ad7c256df61501135b1778df071ad335a9cd86c Mon Sep 17 00:00:00 2001
From: Tux <write@imaginarycode.com>
Date: Tue, 25 Oct 2016 12:34:41 -0400
Subject: [PATCH] Validate that chat messages are non-blank
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java
index c30093d7..d72208e7 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java
@@ -188,6 +188,7 @@ public class UpstreamBridge extends PacketHandler
private String handleChat(String message)
{
+ boolean empty = true;
for ( int index = 0, length = message.length(); index < length; index++ )
{
char c = message.charAt( index );
@@ -195,8 +196,11 @@ public class UpstreamBridge extends PacketHandler
{
con.disconnect( bungee.getTranslation( "illegal_chat_characters", Util.unicode( c ) ) );
throw CancelSendSignal.INSTANCE;
+ } else if (empty && !Character.isWhitespace(c)) {
+ empty = false;
}
}
+ Preconditions.checkArgument(!empty, "Chat message is empty");
ChatEvent chatEvent = new ChatEvent( con, con.getServer(), message );
if ( !bungee.getPluginManager().callEvent( chatEvent ).isCancelled() )
--
2.38.1