Waterfall/BungeeCord-Patches/0022-Validate-that-chat-messages-are-non-blank.patch
Shane Freeder 5254ae0ebe
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:
b34cfcde Simplify UpstreamBridge packet handling code
86e079a4 #3523, #3534: Fix kicking players with error
1c42c340 #3529: Use a synchronized list for /send command
2023-09-28 02:22:46 +01:00

37 lines
1.5 KiB
Diff

From aa9261c4f9c7cac4124d7c144038b033952b3503 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 045e9545..212cdbf2 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
@@ -200,6 +200,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 );
@@ -207,8 +208,14 @@ 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;
}
}
+ if (empty) {
+ con.disconnect("Chat message is empty");
+ throw CancelSendSignal.INSTANCE;
+ }
ChatEvent chatEvent = new ChatEvent( con, con.getServer(), message );
if ( !bungee.getPluginManager().callEvent( chatEvent ).isCancelled() )
--
2.42.0