mirror of
https://github.com/PaperMC/Waterfall.git
synced 2024-11-19 00:35:55 +01:00
Patches.
This commit is contained in:
parent
3dca451dcb
commit
6f04399d90
25
0025-Check-if-packetID-is-invalid.patch
Normal file
25
0025-Check-if-packetID-is-invalid.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From e4a35d4d710e5781cb384e3ad08309f43c0f4b44 Mon Sep 17 00:00:00 2001
|
||||
From: PermisosDev <55111245+PermisosDev@users.noreply.github.com>
|
||||
Date: Thu, 15 Apr 2021 08:34:57 -0300
|
||||
Subject: [PATCH] Check if packetID is invalid.
|
||||
|
||||
|
||||
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 dd089abd..b3de7a7b 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
|
||||
@@ -65,7 +65,10 @@ public class MinecraftDecoder extends MessageToMessageDecoder<ByteBuf>
|
||||
|
||||
int packetId = DefinedPacket.readVarInt( in );
|
||||
packetTypeInfo = packetId;
|
||||
-
|
||||
+ // FlameCord Start - Check if packetId is invalid.
|
||||
+ if (packetId < 0 || packetId > 255)
|
||||
+ throw new BadPacketException("[" + ctx.channel().remoteAddress() + "] <-> MinecraftDecoder received invalid packet #1, id " + packetId);
|
||||
+ // Flamecord End
|
||||
DefinedPacket packet = prot.createPacket( packetId, protocolVersion, supportsForge );
|
||||
if ( packet != null )
|
||||
{
|
||||
--
|
||||
2.29.2.windows.3
|
||||
|
@ -0,0 +1,21 @@
|
||||
From 47c853f657b01df7a8202cd2a17bb7bfc8f8bc7c Mon Sep 17 00:00:00 2001
|
||||
From: PermisosDev <55111245+PermisosDev@users.noreply.github.com>
|
||||
Date: Thu, 15 Apr 2021 08:38:32 -0300
|
||||
Subject: [PATCH] Skip bytes in MinecraftDecoder if ByteBuf is readable.
|
||||
|
||||
|
||||
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 b3de7a7b..5d9be1ba 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
|
||||
@@ -83,6 +83,7 @@ public class MinecraftDecoder extends MessageToMessageDecoder<ByteBuf>
|
||||
throw PACKET_NOT_READ_TO_END;
|
||||
}
|
||||
// Waterfall end
|
||||
+ in.skipBytes(in.readableBytes()); // Flamecord - Skip bytes.
|
||||
throw new BadPacketException( "Did not read all bytes from packet " + packet.getClass() + " " + packetId + " Protocol " + protocol + " Direction " + prot.getDirection() );
|
||||
}
|
||||
} else
|
||||
--
|
||||
2.29.2.windows.3
|
||||
|
Loading…
Reference in New Issue
Block a user