Waterfall/BungeeCord-Patches/0022-Validate-that-chat-messages-are-non-blank.patch
Shane Freeder 25ecd402f3
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:
1a807731 #3567: Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.6.2 to 3.6.3
772ad995 #3566: Bump actions/setup-java from 3 to 4
2431c40a #3562: Bump io.netty:netty-bom from 4.1.100.Final to 4.1.101.Final
8144ae8d #3555: Bump com.mysql:mysql-connector-j from 8.1.0 to 8.2.0
0757c39a Attempt upgrade of resolver libraries
2023-12-13 15:18:04 +00:00

37 lines
1.5 KiB
Diff

From 507a31bafc173948203073eed02cf798677e522e 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 6acbf7bf..05e3bd21 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
@@ -199,6 +199,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 );
@@ -206,8 +207,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.43.0