Paper/patches/server/0893-Do-not-accept-invalid-client-settings.patch
Nassim Jahnke 0ddd20c6f7
Updated Upstream (CraftBukkit/Spigot)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
ead719a65 SPIGOT-7136: Cancelling PlayerInteractEntityEvent with the Allay desyncs
8468e167e SPIGOT-7137: StructureGrowEvent isFromBonemeal and getPlayer have incorrect values
d45057c59 SPIGOT-7089: Crash when command blocks attempt to load worlds

Spigot Changes:
450dcaa8 Rebuild patches
2022-08-14 10:03:13 +02:00

25 lines
1.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
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 f047f1027c5556b4dd7fe51875f075b3ba515c7f..82230f8f4e7f5287fe7f2da9ad5ad7d86ff28782 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3598,6 +3598,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void handleClientInformation(ServerboundClientInformationPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
+ // 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);
}