geforkt von Mirrors/Paper
Do not accept invalid client settings
Dieser Commit ist enthalten in:
Ursprung
7483a45e55
Commit
4aa035fa95
24
patches/server/Do-not-accept-invalid-client-settings.patch
Normale Datei
24
patches/server/Do-not-accept-invalid-client-settings.patch
Normale Datei
@ -0,0 +1,24 @@
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@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);
|
||||
}
|
||||
|
@ -1066,7 +1066,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ protected int getClientViewDistance() {
|
||||
+ return this.player.clientViewDistance == null ? -1 : this.player.clientViewDistance.intValue();
|
||||
+ return this.player.clientViewDistance == null ? -1 : Math.max(0, this.player.clientViewDistance.intValue());
|
||||
+ }
|
||||
+
|
||||
+ public void update() {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren