-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
33 additions
and
49 deletions.
There are no files selected for viewing
File renamed without changes.
30 changes: 0 additions & 30 deletions
30
patches/server/0060-Allow-disabling-component-selector-resolving-in-book.patch
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,9 @@ From: uRyanxD <[email protected]> | |
Date: Fri, 9 Dec 2022 13:17:43 -0300 | ||
Subject: [PATCH] Book security improvements | ||
|
||
Co-authored-by: RoccoDev | ||
Co-authored-by: bob7l | ||
Co-authored-by: RoccoDev <[email protected]> | ||
Co-authored-by: xism4 <[email protected]> | ||
|
||
diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java | ||
index ad33280bb8baab581a4ac17b5fe78022134c676b..a6480484f2c2f55e6cb4ef682c99f56d46980a0e 100644 | ||
|
@@ -20,7 +21,7 @@ index ad33280bb8baab581a4ac17b5fe78022134c676b..a6480484f2c2f55e6cb4ef682c99f56d | |
} | ||
|
||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java | ||
index 14afdc7cbb88150f4711811a06fa149c36cec8b9..3904c77141ec3b778dc6cc2fd256961b7598ab31 100644 | ||
index 1f80521c97fd7b0ef263b9e17cb79bcc51db0433..f5ef763b8783a6a275b5d4311d368bed25e3b878 100644 | ||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java | ||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java | ||
@@ -111,6 +111,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList | ||
|
@@ -60,10 +61,10 @@ index 14afdc7cbb88150f4711811a06fa149c36cec8b9..3904c77141ec3b778dc6cc2fd256961b | |
|
||
try { | ||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java | ||
index 0b5ada0118f521eaca65b0fd67ebf232fa183b1a..8f46643ddcd0365c842384268a92aa475f03a97c 100644 | ||
index 0b5ada0118f521eaca65b0fd67ebf232fa183b1a..44b3c3ac151fecebd41b43b7bb6708cb8508dc50 100644 | ||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java | ||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java | ||
@@ -33,8 +33,11 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
@@ -33,8 +33,12 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
static final ItemMetaKey BOOK_PAGES = new ItemMetaKey("pages"); | ||
static final ItemMetaKey RESOLVED = new ItemMetaKey("resolved"); | ||
static final ItemMetaKey GENERATION = new ItemMetaKey("generation"); | ||
|
@@ -72,12 +73,13 @@ index 0b5ada0118f521eaca65b0fd67ebf232fa183b1a..8f46643ddcd0365c842384268a92aa47 | |
+ // PandaSpigot start - Add security limits to books | ||
+ static final int MAX_PAGES = 50; | ||
+ static final int MAX_PAGE_LENGTH = 256; | ||
+ static final int MAX_TITLE_LENGTH = 32; | ||
+ static final int MAX_TITLE_LENGTH = 16; | ||
+ static final int MAX_AUTHOR_LENGHT = 16; | ||
+ // PandaSpigot end | ||
|
||
protected String title; | ||
protected String author; | ||
@@ -61,11 +64,11 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
@@ -61,11 +65,11 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
super(tag); | ||
|
||
if (tag.hasKey(BOOK_TITLE.NBT)) { | ||
|
@@ -87,11 +89,11 @@ index 0b5ada0118f521eaca65b0fd67ebf232fa183b1a..8f46643ddcd0365c842384268a92aa47 | |
|
||
if (tag.hasKey(BOOK_AUTHOR.NBT)) { | ||
- this.author = limit( tag.getString(BOOK_AUTHOR.NBT), 1024 ); // Spigot | ||
+ this.author = limit( tag.getString(BOOK_AUTHOR.NBT), 16 ); // Spigot // PandaSpigot | ||
+ this.author = limit( tag.getString(BOOK_AUTHOR.NBT), MAX_AUTHOR_LENGHT ); // Spigot // PandaSpigot | ||
} | ||
|
||
boolean resolved = false; | ||
@@ -80,7 +83,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
@@ -80,7 +84,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
if (tag.hasKey(BOOK_PAGES.NBT) && handlePages) { | ||
NBTTagList pages = tag.getList(BOOK_PAGES.NBT, 8); | ||
|
||
|
@@ -100,7 +102,7 @@ index 0b5ada0118f521eaca65b0fd67ebf232fa183b1a..8f46643ddcd0365c842384268a92aa47 | |
String page = pages.getString(i); | ||
if (resolved) { | ||
try { | ||
@@ -90,7 +93,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
@@ -90,7 +94,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
// Ignore and treat as an old book | ||
} | ||
} | ||
|
@@ -109,7 +111,7 @@ index 0b5ada0118f521eaca65b0fd67ebf232fa183b1a..8f46643ddcd0365c842384268a92aa47 | |
} | ||
} | ||
} | ||
@@ -104,7 +107,9 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
@@ -104,7 +108,9 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
|
||
Iterable<?> pages = SerializableMeta.getObject(Iterable.class, map, BOOK_PAGES.BUKKIT, true); | ||
if(pages != null) { | ||
|
@@ -119,3 +121,15 @@ index 0b5ada0118f521eaca65b0fd67ebf232fa183b1a..8f46643ddcd0365c842384268a92aa47 | |
if (page instanceof String) { | ||
addPage((String) page); | ||
} | ||
@@ -188,7 +194,10 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
this.title = null; | ||
return true; | ||
} else if (title.length() > MAX_TITLE_LENGTH) { | ||
- return false; | ||
+ // PandaSpigot start | ||
+ this.title = title.substring(0, MAX_TITLE_LENGTH); | ||
+ return true; | ||
+ // PandaSpigot end | ||
} | ||
|
||
this.title = title; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.