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:
5e7dcc48 #3382: Use the correct write method for ChatChain in ClientChat packet
5cdba87b #3377: Add additional checks for protocol length limits
This commit is contained in:
Shane Freeder 2022-08-20 17:43:03 +01:00
parent 6ca6b706df
commit f49e238640
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C
21 changed files with 52 additions and 102 deletions

@ -1 +1 @@
Subproject commit 696315615d67cc5387b502d1d5ac0ceaae4fadbf
Subproject commit 5e7dcc48b9c55a573bdfed7bd75b388a53b1f4f6

View File

@ -1,4 +1,4 @@
From 8789a416b075862da97e7348e9b6583666ced815 Mon Sep 17 00:00:00 2001
From 658ea2fe15fc6d455beb8cc4d5d271e29fcb155d Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sat, 30 Mar 2019 15:11:11 +0000
Subject: [PATCH] Fix upstream javadocs
@ -104,5 +104,5 @@ index f3bced0a..4a198ee9 100644
Favicon getFaviconObject();
--
2.30.1 (Apple Git-130)
2.37.2

View File

@ -1,50 +0,0 @@
From a8361371f69b268c3b3b29d5460a92ed56d99eca Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Wed, 20 Mar 2019 21:39:12 -0700
Subject: [PATCH] Use proper max length for serverbound chat packet
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/DefinedPacket.java b/protocol/src/main/java/net/md_5/bungee/protocol/DefinedPacket.java
index 8b2a2822..ab9519f9 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/DefinedPacket.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/DefinedPacket.java
@@ -56,6 +56,20 @@ public abstract class DefinedPacket
return s;
}
+ // Waterfall start
+ public static void writeString(String s, final int maxLength, ByteBuf buf)
+ {
+ if ( s.length() > maxLength )
+ {
+ throw new OverflowPacketException( String.format( "Cannot send string longer than %s (got %s characters)", maxLength, s.length() ) );
+ }
+
+ byte[] b = s.getBytes( Charsets.UTF_8 );
+ writeVarInt( b.length, buf );
+ buf.writeBytes( b );
+ }
+ // Waterfall end
+
public static void writeArray(byte[] b, ByteBuf buf)
{
if ( b.length > Short.MAX_VALUE )
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Chat.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Chat.java
index 11b04c2a..6034fc18 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Chat.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Chat.java
@@ -54,6 +54,11 @@ public class Chat extends DefinedPacket
@Override
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{
+ // Waterfall start
+ if (direction == ProtocolConstants.Direction.TO_CLIENT) {
+ writeString(this.message, Short.MAX_VALUE * 8 + 8, buf);
+ } else
+ // Waterfall end
writeString( message, buf );
if ( direction == ProtocolConstants.Direction.TO_CLIENT )
{
--
2.30.1 (Apple Git-130)

View File

@ -1,4 +1,4 @@
From 66e5a2d53c7935418cda69ab06874731831a266b Mon Sep 17 00:00:00 2001
From 893c4dbda0b4fa64d720f3ec510965b5aeb9df3f Mon Sep 17 00:00:00 2001
From: Colin Godsey <crgodsey@gmail.com>
Date: Tue, 16 Apr 2019 07:25:52 -0600
Subject: [PATCH] OSX native zlib and crypto
@ -1215,5 +1215,5 @@ literal 0
HcmV?d00001
--
2.30.1 (Apple Git-130)
2.37.2

View File

@ -1,4 +1,4 @@
From b792a930ccd6e6d53c325b46076212ff24515b81 Mon Sep 17 00:00:00 2001
From 6a64004d21456f947e63aaa1d1a039fca8a3bb92 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Mon, 25 Nov 2019 19:54:06 +0000
Subject: [PATCH] Speed up some common exceptions
@ -67,7 +67,7 @@ index 6c0ef4df..f20104a2 100644
+ // Waterfall end
}
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/DefinedPacket.java b/protocol/src/main/java/net/md_5/bungee/protocol/DefinedPacket.java
index 5a330607..c4af6e76 100644
index 5fe55dcc..122e3b52 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/DefinedPacket.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/DefinedPacket.java
@@ -19,6 +19,9 @@ import se.llbit.nbt.Tag;
@ -79,8 +79,8 @@ index 5a330607..c4af6e76 100644
+ private static final BadPacketException NO_MORE_BYTES_EXCEPTION = new BadPacketException("No more bytes reading varint");
public static void writeString(String s, ByteBuf buf)
{
if ( s.length() > Short.MAX_VALUE )
@@ -150,13 +153,18 @@ public abstract class DefinedPacket
writeString( s, buf, Short.MAX_VALUE );
@@ -145,13 +148,18 @@ public abstract class DefinedPacket
byte in;
while ( true )
{
@ -195,5 +195,5 @@ index ac99d02c..0c1ecfb8 100644
// Waterfall start
--
2.37.1
2.37.2

View File

@ -1,4 +1,4 @@
From 8f597104fbf7db67b2f09731b116be384bb5089d Mon Sep 17 00:00:00 2001
From 69c3602785646ebd3cb76a3bc20123444f9b6e0a Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Mon, 2 Dec 2019 11:35:17 +0000
Subject: [PATCH] ConnectionInitEvent
@ -119,5 +119,5 @@ index 2d373660..2a21243b 100644
};
public static final Base BASE = new Base();
--
2.32.0 (Apple Git-132)
2.37.2

View File

@ -1,4 +1,4 @@
From 47a27d5323e96b3cb1bbcee998d413017eff43b0 Mon Sep 17 00:00:00 2001
From 1e0eebdd511f09952c96780603ec4ba3c50bf051 Mon Sep 17 00:00:00 2001
From: theminecoder <theminecoder.dev@gmail.com>
Date: Wed, 22 Apr 2020 14:00:44 +1000
Subject: [PATCH] Add exception reporting event
@ -551,7 +551,7 @@ index 4180c995..90031156 100644
* Register a {@link Listener} for receiving called events. Methods in this
* Object which wish to receive events must be annotated with the
diff --git a/event/src/main/java/net/md_5/bungee/event/EventBus.java b/event/src/main/java/net/md_5/bungee/event/EventBus.java
index b3effc8a..adb9f636 100644
index fb301a44..1187acd0 100644
--- a/event/src/main/java/net/md_5/bungee/event/EventBus.java
+++ b/event/src/main/java/net/md_5/bungee/event/EventBus.java
@@ -34,7 +34,8 @@ public class EventBus
@ -642,7 +642,7 @@ index fbfbd546..ae85a1d4 100644
@EventHandler
diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
index c5f2a92d..c7b0ab25 100644
index 06784d1e..d4df4c17 100644
--- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
+++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
@@ -11,6 +11,8 @@ import com.google.gson.Gson;
@ -695,5 +695,5 @@ index 38b75b51..02ec98fc 100644
// If we have a period of 0 or less, only run once
--
2.33.0
2.37.2

View File

@ -1,4 +1,4 @@
From dd6a077069d7c3b46b2df58f4cb5c955f485e48f Mon Sep 17 00:00:00 2001
From 8539f47471127e98aae462b3e99162913ee41663 Mon Sep 17 00:00:00 2001
From: xDark <aleshkailyashevich@gmail.com>
Date: Fri, 31 May 2019 08:11:31 +0300
Subject: [PATCH] Allow to disable tablist rewrite
@ -71,5 +71,5 @@ index a4f242b2..9dfb11e9 100644
@Override
--
2.37.1
2.37.2

View File

@ -1,4 +1,4 @@
From 1df5f9893bcbb0b8b15015247aa8b19ea899b488 Mon Sep 17 00:00:00 2001
From 9517e5243c1c1a99dac097ab47522deb1918109b Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sat, 20 Jun 2020 18:21:17 +0100
Subject: [PATCH] Remove version from brand info
@ -18,5 +18,5 @@ index 9dfb11e9..59d204ce 100644
brand.release();
// changes in the packet are ignored so we need to send it manually
--
2.37.1
2.37.2

View File

@ -1,4 +1,4 @@
From 31819af9137d9e22392d3dee782a26d690651644 Mon Sep 17 00:00:00 2001
From e1900e56571d893043a6f83368c0de0e11f656d2 Mon Sep 17 00:00:00 2001
From: theminecoder <theminecoder.dev@gmail.com>
Date: Sun, 19 Jul 2020 10:18:23 +1000
Subject: [PATCH] Add auth url option
@ -27,5 +27,5 @@ index 5331518b..5ee47b6a 100644
Callback<String> handler = new Callback<String>()
{
--
2.37.1
2.37.2

View File

@ -1,4 +1,4 @@
From 8354e44c10d3e1a46b0fba7e5c38d10743b2580c Mon Sep 17 00:00:00 2001
From b6366cee1ab16d0c0ec04efd433f12e118206ad0 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Tue, 15 Sep 2020 18:11:49 +0100
Subject: [PATCH] Add the ability to generate decoder traces for debugging
@ -40,5 +40,5 @@ index 2583aa2c..334d5054 100644
}
}
--
2.30.1 (Apple Git-130)
2.37.2

View File

@ -1,4 +1,4 @@
From 98f8f9fe6e5931287e3711324cf2055f8d13cfd2 Mon Sep 17 00:00:00 2001
From 6a4bb0c0def82d865517d5d08810a3f68a60acf1 Mon Sep 17 00:00:00 2001
From: "Five (Xer)" <admin@fivepb.me>
Date: Sat, 30 Jan 2021 18:04:14 +0100
Subject: [PATCH] Additional DoS mitigations
@ -8,26 +8,26 @@ Courtesy of Tux and the Velocity Contributors. See:
https://github.com/VelocityPowered/Velocity/commit/5ceac16a821ea35572ff11412ace8929fd06e278
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/DefinedPacket.java b/protocol/src/main/java/net/md_5/bungee/protocol/DefinedPacket.java
index c4af6e76..bafef27c 100644
index 122e3b52..561a9522 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/DefinedPacket.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/DefinedPacket.java
@@ -44,6 +44,7 @@ public abstract class DefinedPacket
@@ -54,6 +54,7 @@ public abstract class DefinedPacket
int len = readVarInt( buf );
if ( len > maxLen * 4 )
if ( len > maxLen * 3 )
{
+ if(!MinecraftDecoder.DEBUG) throw STRING_TOO_MANY_BYTES_EXCEPTION; // Waterfall start: Additional DoS mitigations
throw new OverflowPacketException( "Cannot receive string longer than " + maxLen * 4 + " (got " + len + " bytes)" );
throw new OverflowPacketException( "Cannot receive string longer than " + maxLen * 3 + " (got " + len + " bytes)" );
}
@@ -53,6 +54,7 @@ public abstract class DefinedPacket
String s = new String( b, Charsets.UTF_8 );
@@ -62,6 +63,7 @@ public abstract class DefinedPacket
if ( s.length() > maxLen )
{
+ if(!MinecraftDecoder.DEBUG) throw STRING_TOO_LONG_EXCEPTION; // Waterfall start: Additional DoS mitigations
throw new OverflowPacketException( "Cannot receive string longer than " + maxLen + " (got " + s.length() + " characters)" );
}
@@ -351,4 +353,21 @@ public abstract class DefinedPacket
@@ -346,4 +348,21 @@ public abstract class DefinedPacket
@Override
public abstract String toString();
@ -235,5 +235,5 @@ index 738f0c92..ec33d337 100644
+ // Waterfall end
}
--
2.37.1
2.37.2

View File

@ -1,4 +1,4 @@
From 1156e7cb85a6b72eab3b9fcea8a139d7440ce4e2 Mon Sep 17 00:00:00 2001
From 792b25bd6d93cdf296150f8cce4dc127faf835e0 Mon Sep 17 00:00:00 2001
From: Josh Roy <10731363+JRoy@users.noreply.github.com>
Date: Sun, 21 Feb 2021 23:52:11 -0500
Subject: [PATCH] Add support for hex color codes in console
@ -32,7 +32,7 @@ index 6e9c09c5..1c3265ed 100644
</PatternLayout>
<Policies>
diff --git a/log4j/src/main/resources/log4j2.xml b/log4j/src/main/resources/log4j2.xml
index 3b3525f0..a42d63fa 100644
index 8e49e002..663bddec 100644
--- a/log4j/src/main/resources/log4j2.xml
+++ b/log4j/src/main/resources/log4j2.xml
@@ -3,17 +3,17 @@
@ -242,5 +242,5 @@ index 00000000..5d1a6126
+}
+
--
2.30.1 (Apple Git-130)
2.37.2

View File

@ -1,4 +1,4 @@
From 33d50f1adeab9abcdece0bf5253b7a42760644da Mon Sep 17 00:00:00 2001
From 56e1c45d29bbb4edf52f4663628ba7743400f2e2 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Fri, 9 Jul 2021 13:20:36 +0100
Subject: [PATCH] Don't bother locking to fetch a v4 UUID from the offline
@ -22,5 +22,5 @@ index d4df4c17..9ef2b77a 100644
try
{
--
2.35.1
2.37.2

View File

@ -1,4 +1,4 @@
From b6595ae3586fe015b823d392774a510e5d807759 Mon Sep 17 00:00:00 2001
From 081317fa31119499ac8661bbdbb2c8207d99322d Mon Sep 17 00:00:00 2001
From: FivePB <admin@fivepb.me>
Date: Tue, 16 Nov 2021 21:15:32 +0100
Subject: [PATCH] Configurable plugin messaging limits
@ -101,5 +101,5 @@ index 5ee47b6a..4a8cb3df 100644
}
} else if ( input.getTag().equals( "UNREGISTER" ) || input.getTag().equals( "minecraft:unregister" ) )
--
2.37.1
2.37.2

View File

@ -1,4 +1,4 @@
From e464662942d3aa32ab99b80a37586aec91fde652 Mon Sep 17 00:00:00 2001
From dbbaf10f0d11e08489bd0e29b3788ea76bf282ac Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Fri, 16 Apr 2021 06:29:28 +0100
Subject: [PATCH] ServerConnectRequest#sendFeedback
@ -90,5 +90,5 @@ index 5961392a..eb236957 100644
}
}
--
2.32.1 (Apple Git-133)
2.37.2

View File

@ -1,4 +1,4 @@
From bc5d7679dfba5cfbd19fe085d3d3ddeea12375d8 Mon Sep 17 00:00:00 2001
From ab3fe51154af6559ace6fba45542f6ad982f339f Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Tue, 22 Mar 2022 14:56:44 +0000
Subject: [PATCH] Don't send exceptions to the client during kicks, etc
@ -27,5 +27,5 @@ index eb236957..b44d13e5 100644
@Override
--
2.32.1 (Apple Git-133)
2.37.2

View File

@ -1,4 +1,4 @@
From 3f69c973c1887a0c1ee3763dd62460ded540dd54 Mon Sep 17 00:00:00 2001
From 34ac95f94206ae5c449a1bb6fffca5dfa16b1256 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 8 May 2022 12:04:30 +0100
Subject: [PATCH] Improve login state transition
@ -26,5 +26,5 @@ index 4a8cb3df..6011078f 100644
}
--
2.37.1
2.37.2

View File

@ -1,4 +1,4 @@
From 06e5ba42d7e797c36e15c761142d185d3a7a7425 Mon Sep 17 00:00:00 2001
From f3af05e83cb5b18878d1a15ef93e843e8cd952eb Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 12 Jun 2022 06:45:54 +0100
Subject: [PATCH] Add protocol version to packet not found message
@ -34,5 +34,5 @@ index 9701705d..b852a24e 100644
}
}
--
2.37.1
2.37.2

View File

@ -1,4 +1,4 @@
From 89e029d78808f9db204b1552e22cdbb47cdf6da5 Mon Sep 17 00:00:00 2001
From 1b92363555d7dfb55df0360c64e8fc18d2f5716c Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 19 Jun 2022 10:31:51 +0100
Subject: [PATCH] Expand packet-decode-logging usage
@ -24,5 +24,5 @@ index 33494237..29cf4b4f 100644
{
ProxyServer.getInstance().getLogger().log( Level.WARNING, "{0} - corrupted frame: {1}", new Object[]
--
2.32.1 (Apple Git-133)
2.37.2

View File

@ -1,4 +1,4 @@
From e1d9793c800fb426a1f6b4245c2e20da93ec01b3 Mon Sep 17 00:00:00 2001
From 1106fef0e1590a513bb90264917f15ec77626251 Mon Sep 17 00:00:00 2001
From: Aurora <aurora@relanet.eu>
Date: Mon, 18 Jul 2022 15:56:05 +0200
Subject: [PATCH] Add message for outdated clients that don't support secure
@ -32,5 +32,5 @@ index e42b798b..76ad621f 100644
error_occurred_player=\u00a7cAn error occurred while parsing your message. (Hover for details)
error_occurred_console=\u00a7cAn error occurred while parsing your message: {0}
--
2.37.1
2.37.2