Only ignore empty packets from the server (Fixes #467)

this patch orignally existed to prevent the constant cries from bad server
owners, however creates some room for abuse, this should plug that
hole by only allowing the server to send such broken packets
This commit is contained in:
Shane Freeder 2021-04-14 14:31:57 +01:00
parent 49605839bc
commit c19c4771de
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C

View File

@ -1,4 +1,4 @@
From 25d644ee21e0ebfc53376a8da62c5079c2d55a32 Mon Sep 17 00:00:00 2001 From b33cec4e8b6ef1f9189a03fae0cc83d894b6f617 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com> From: Shane Freeder <theboyetronic@gmail.com>
Date: Fri, 12 Oct 2018 14:28:52 +0100 Date: Fri, 12 Oct 2018 14:28:52 +0100
Subject: [PATCH] Ignore empty packets Subject: [PATCH] Ignore empty packets
@ -8,7 +8,7 @@ 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 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 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 index 961887c9..13565e4e 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java --- a/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java
+++ b/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> @@ -43,6 +43,12 @@ public class MinecraftDecoder extends MessageToMessageDecoder<ByteBuf>
@ -16,7 +16,7 @@ index 961887c9..a2c72c9b 100644
try try
{ {
+ // Waterfall start + // Waterfall start
+ if (in.readableBytes() == 0) { + if (in.readableBytes() == 0 && server) {
+ return; + return;
+ } + }
+ // Waterfall end + // Waterfall end
@ -38,5 +38,5 @@ index 647394ba..f297620c 100644
throw new CorruptedFrameException( "Empty Packet!" ); throw new CorruptedFrameException( "Empty Packet!" );
} }
-- --
2.25.1 2.31.0