mirror of
https://github.com/PaperMC/Waterfall.git
synced 2024-07-05 19:04:43 +02:00
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 BungeeCord Changes: 70370faf Add checkstyle indentation checks 24a53a67 Show socketAddress in BungeeServerInfo.toString 503b4827 Fix bad formatting in EntityMap eeb37479 #2710: Store queue of pending keepalives 3f6aa033 Also check that things that should not be padded are so 78a84953 Add more checkstyle rules 636c0207 #2753: Add configurable remote ping caching a4512e50 Check Maven version in action build & don't print noisy transfer progress f510989c Add building of pull requests via GitHub Actions
58 lines
2.3 KiB
Diff
58 lines
2.3 KiB
Diff
From fd2323156681ae38aeea32eb4c7b1f2141c4be93 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/io/github/waterfallmc/waterfall/StringUtil.java b/proxy/src/main/java/io/github/waterfallmc/waterfall/StringUtil.java
|
|
new file mode 100644
|
|
index 00000000..940ad806
|
|
--- /dev/null
|
|
+++ b/proxy/src/main/java/io/github/waterfallmc/waterfall/StringUtil.java
|
|
@@ -0,0 +1,22 @@
|
|
+package io.github.waterfallmc.waterfall;
|
|
+
|
|
+import lombok.AccessLevel;
|
|
+import lombok.NoArgsConstructor;
|
|
+
|
|
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
|
+public class StringUtil {
|
|
+ public static boolean isBlank(String str) {
|
|
+ if (str.isEmpty()) {
|
|
+ return true;
|
|
+ }
|
|
+
|
|
+ int l = str.length();
|
|
+ for (int i = 0; i < l; i++) {
|
|
+ if (!Character.isWhitespace(str.charAt(i))) {
|
|
+ return false;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return true;
|
|
+ }
|
|
+}
|
|
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 d44d4c2e..4d8bac5d 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
|
|
@@ -4,6 +4,7 @@ import com.google.common.base.Preconditions;
|
|
import com.mojang.brigadier.context.StringRange;
|
|
import com.mojang.brigadier.suggestion.Suggestion;
|
|
import com.mojang.brigadier.suggestion.Suggestions;
|
|
+import io.github.waterfallmc.waterfall.StringUtil;
|
|
import io.netty.channel.Channel;
|
|
import java.util.ArrayList;
|
|
import java.util.LinkedList;
|
|
@@ -142,6 +143,7 @@ public class UpstreamBridge extends PacketHandler
|
|
{
|
|
int maxLength = ( con.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_11 ) ? 256 : 100;
|
|
Preconditions.checkArgument( chat.getMessage().length() <= maxLength, "Chat message too long" ); // Mojang limit, check on updates
|
|
+ Preconditions.checkArgument(!StringUtil.isBlank(chat.getMessage()), "Chat message is empty");
|
|
|
|
ChatEvent chatEvent = new ChatEvent( con, con.getServer(), chat.getMessage() );
|
|
if ( !bungee.getPluginManager().callEvent( chatEvent ).isCancelled() )
|
|
--
|
|
2.25.0
|
|
|