Waterfall/Waterfall-Proxy-Patches/0025-Apply-packet-limits.patch

56 lines
2.2 KiB
Diff
Raw Normal View History

2022-03-04 17:38:12 +01:00
From 596bb7b14abdea0ba23fa966a6d594977c230331 Mon Sep 17 00:00:00 2001
2021-06-29 07:55:59 +02:00
From: LinsaFTW <25271111+linsaftw@users.noreply.github.com>
Date: Thu, 10 Jun 2021 11:30:19 -0300
Subject: [PATCH] Apply packet limits
2022-02-15 22:34:26 +01:00
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/EncryptionRequest.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/EncryptionRequest.java
index 86182cdd..b28f4081 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/EncryptionRequest.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/EncryptionRequest.java
@@ -61,4 +61,14 @@ public class EncryptionRequest extends DefinedPacket
{
handler.handle( this );
}
+
+ @Override
+ public int expectedMaxLength(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
+ return 20 + 256 + 256; // FlameCord - Apply packet limits
+ }
+
+ @Override
+ public int expectedMinLength(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
+ return 20 + 1 + 1; // FlameCord - Apply packet limits
+ }
}
2021-06-29 07:55:59 +02:00
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Handshake.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Handshake.java
2022-02-15 22:34:26 +01:00
index 7dbbfd3c..b7842055 100644
2021-06-29 07:55:59 +02:00
--- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Handshake.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Handshake.java
@@ -7,6 +7,7 @@ import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import net.md_5.bungee.protocol.AbstractPacketHandler;
import net.md_5.bungee.protocol.DefinedPacket;
+import net.md_5.bungee.protocol.ProtocolConstants;
@Data
@NoArgsConstructor
@@ -43,4 +44,14 @@ public class Handshake extends DefinedPacket
{
handler.handle( this );
}
+
+ @Override
+ public int expectedMaxLength(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
2022-02-15 22:34:26 +01:00
+ return 1036 + 256; // FlameCord - Apply packet limits
2021-06-29 07:55:59 +02:00
+ }
+
+ @Override
+ public int expectedMinLength(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
2022-02-15 22:34:26 +01:00
+ return 5; // FlameCord - Apply packet limits
2021-06-29 07:55:59 +02:00
+ }
}
--
2021-12-30 03:02:28 +01:00
2.32.0
2021-06-29 07:55:59 +02:00