fix book page limit length (#4932)

This commit is contained in:
Jake Potrebic 2020-12-23 14:52:56 -08:00 committed by GitHub
parent 98a702c7d5
commit 4643944343
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,7 +22,7 @@ index ba7fdf482ef8536074fcc3867d7fc142fcfe8ce8..2aca8cc2be963b2b015e52cdec6b3843
+ }
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index cc141f02d5a2b1a5c50e5583d3537d5883762db1..4673efa3f540a6dc2c01a2a601a7c06ee791e8b4 100644
index cc141f02d5a2b1a5c50e5583d3537d5883762db1..6ad02246267f4d95f82164b70c30ac2955c563fe 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -20,6 +20,7 @@ import java.util.function.Consumer;
@ -41,7 +41,7 @@ index cc141f02d5a2b1a5c50e5583d3537d5883762db1..4673efa3f540a6dc2c01a2a601a7c06e
+ ItemStack testStack = packetplayinbedit.getBook();
+ if (!server.isPrimaryThread() && !testStack.isEmpty() && testStack.getTag() != null) {
+ NBTTagList pageList = testStack.getTag().getList("pages", 8);
+ if (pageList.size() > 50) {
+ if (pageList.size() > 100) {
+ PlayerConnection.LOGGER.warn(this.player.getName() + " tried to send a book with too many pages");
+ minecraftServer.scheduleOnMain(() -> this.disconnect("Book too large!"));
+ return;