mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 15:17:17 +01:00
Do not accept invalid client settings
This commit is contained in:
parent
87d2eb2d3b
commit
e399754320
2 changed files with 27 additions and 3 deletions
|
@ -84,7 +84,7 @@ index 309dbf5fce3ce940d5e1b57d267b9d6b2c5ff5b6..5ba64e1083b7cb1eec64d1925095c6ca
|
|||
}));
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 432db841f4b25ab219078501942bcfb586645be1..b6ada92f426c545801b6f0e5b44206f533aca39a 100644
|
||||
index 318e28b5e93b6842d48745ec53bcc25dbfeaff72..66d360b2c4ae9e380ec6c452a263c04bd3aef4ff 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -652,4 +652,35 @@ public class PaperConfig {
|
||||
|
@ -125,7 +125,7 @@ index 432db841f4b25ab219078501942bcfb586645be1..b6ada92f426c545801b6f0e5b44206f5
|
|||
}
|
||||
diff --git a/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java b/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0f62a766a3249d8651a11dce6e9051b162693716
|
||||
index 0000000000000000000000000000000000000000..12bcf96ec1ba4314c7ea2eab9f3d140559f1dc08
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java
|
||||
@@ -0,0 +1,1128 @@
|
||||
|
@ -1066,7 +1066,7 @@ index 0000000000000000000000000000000000000000..0f62a766a3249d8651a11dce6e9051b1
|
|||
+ }
|
||||
+
|
||||
+ 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() {
|
||||
|
|
|
@ -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 1a87f61d534ed531132fb43a9d2a45a4b604a6fc..1a1f3664554ae1f2b0110f615e79fa0568407d17 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -3169,6 +3169,13 @@ 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);
|
||||
}
|
||||
|
Loading…
Reference in a new issue