Waterfall/BungeeCord-Patches/0044-Ignore-empty-packets.patch
riku6460 a6198586d9
Updated Upstream (BungeeCord) (#549)
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:
15b51413 #2908: Don't frame packets for dead connections
a0f9333a Bump version to 1.16-R0.4-SNAPSHOT
287e28a7 Release 1.16-R0.3
c1522ab9 #2909: Don't serialise as array for single element contents
0af4bfdb #2905: HoverEvent getValue compat method
2020-07-19 14:26:04 +01:00

43 lines
1.9 KiB
Diff

From 25d644ee21e0ebfc53376a8da62c5079c2d55a32 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 961887c9..a2c72c9b 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
@@ -43,6 +43,12 @@ public class MinecraftDecoder extends MessageToMessageDecoder<ByteBuf>
Object packetTypeInfo = null;
try
{
+ // Waterfall start
+ if (in.readableBytes() == 0) {
+ 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 647394ba..f297620c 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.25.1