Waterfall/BungeeCord-Patches/0042-Ignore-empty-packets.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

43 lines
1.9 KiB
Diff

From 075bc35b82064130e9b8b5919e62eb05c74fc778 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Fri, 12 Oct 2018 14:28:52 +0100
Subject: [PATCH] Ignore empty packets
This patch puts the proxy more inline with the client in that empty
packets will be ignored. While empty packets are a sign of bad plugins,
they are effectivly harmless vs the cost of the exception in general
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java b/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java
index 2207c3ff..655bcd46 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java
@@ -45,6 +45,12 @@ public class MinecraftDecoder extends MessageToMessageDecoder<ByteBuf>
Object packetTypeInfo = null;
try
{
+ // Waterfall start
+ if (in.readableBytes() == 0 && !server) {
+ return;
+ }
+ // Waterfall end
+
int packetId = DefinedPacket.readVarInt( in );
packetTypeInfo = packetId;
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/Varint21FrameDecoder.java b/protocol/src/main/java/net/md_5/bungee/protocol/Varint21FrameDecoder.java
index 277e70e8..cf7dea17 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/Varint21FrameDecoder.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/Varint21FrameDecoder.java
@@ -40,7 +40,7 @@ public class Varint21FrameDecoder extends ByteToMessageDecoder
if ( buf[i] >= 0 )
{
int length = DefinedPacket.readVarInt( Unpooled.wrappedBuffer( buf ) );
- if ( length == 0 )
+ if ( false && length == 0) // Waterfall - ignore
{
throw new CorruptedFrameException( "Empty Packet!" );
}
--
2.43.0