2022-05-07 23:59:20 +02:00
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
2024-04-28 03:00:01 +02:00
index 688579464e1f6e34f07e37f80efcd31a1a8a0538..33c53c0b2dd755cb63288e9df5bb3dc11b3af55e 100644
2022-05-07 23:59:20 +02:00
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
2024-04-25 23:21:18 +02:00
@@ -3240,6 +3240,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
2022-05-07 23:59:20 +02:00
@Override
public void handleClientInformation(ServerboundClientInformationPacket packet) {
2023-06-08 10:47:19 +02:00
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
2022-05-07 23:59:20 +02:00
+ // Paper start - do not accept invalid information
2023-09-22 17:24:59 +02:00
+ if (packet.information().viewDistance() < 0) {
+ LOGGER.warn("Disconnecting " + this.player.getScoreboardName() + " for invalid view distance: " + packet.information().viewDistance());
2023-09-22 19:31:02 +02:00
+ this.disconnect("Invalid client settings", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION);
2022-05-07 23:59:20 +02:00
+ return;
+ }
+ // Paper end - do not accept invalid information
2023-09-22 17:24:59 +02:00
this.player.updateOptions(packet.information());
2023-09-23 01:42:59 +02:00
this.connection.channel.attr(io.papermc.paper.adventure.PaperAdventure.LOCALE_ATTRIBUTE).set(net.kyori.adventure.translation.Translator.parseLocale(packet.information().language())); // Paper
2022-05-07 23:59:20 +02:00
}