aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0828-Do-not-accept-invalid-client-settings.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0828-Do-not-accept-invalid-client-settings.patch')
-rw-r--r--patches/server/0828-Do-not-accept-invalid-client-settings.patch24
1 files changed, 24 insertions, 0 deletions
diff --git a/patches/server/0828-Do-not-accept-invalid-client-settings.patch b/patches/server/0828-Do-not-accept-invalid-client-settings.patch
new file mode 100644
index 0000000000..a9c4ffb6dc
--- /dev/null
+++ b/patches/server/0828-Do-not-accept-invalid-client-settings.patch
@@ -0,0 +1,24 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Spottedleaf <[email protected]>
+Date: Sat, 7 May 2022 14:58:53 -0700
+Subject: [PATCH] Do not accept invalid client settings
+
+
+diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+index 0b0a839fafca6b1889adde84af9a66071df191ce..3382303303626a2a71ba7e70a1ced615a619d408 100644
+--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+@@ -3450,6 +3450,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
+ @Override
+ public void handleClientInformation(ServerboundClientInformationPacket packet) {
+ PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
++ // Paper start - do not accept invalid information
++ if (packet.viewDistance() < 0) {
++ LOGGER.warn("Disconnecting " + this.player.getScoreboardName() + " for invalid view distance: " + packet.viewDistance());
++ this.disconnect("Invalid client settings", PlayerKickEvent.Cause.ILLEGAL_ACTION);
++ return;
++ }
++ // Paper end - do not accept invalid information
+ this.player.updateOptions(packet);
+ }
+