3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-14 20:10:05 +01:00
Paper/patches/server/0376-Do-not-accept-invalid-client-settings.patch

25 Zeilen
1.7 KiB
Diff

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-10-27 18:11:15 +01:00
index 8bb1b0e7caa938170169379ce22f21c1c772db60..00ce20359f6d73acf3f1016806e5f4f3b6d01bcd 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-10-27 18:11:15 +01:00
@@ -3300,6 +3300,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
+ if (packet.information().viewDistance() < 0) {
+ LOGGER.warn("Disconnecting " + this.player.getScoreboardName() + " for invalid view distance: " + packet.information().viewDistance());
2024-06-14 14:11:52 +02:00
+ this.disconnect(Component.literal("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
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
}