From f71ef566dff0d2b1ef510ec1d9ccc3af260376a7 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 21 Sep 2016 23:56:41 -0400 Subject: [PATCH] Raise string limit for packet serialization The default limit is possible to hit with 50 page books with color codes, causing clients to disconnect. Bump the limit up a hair to above currently seen sizes. --- ...tring-limit-for-packet-serialization.patch | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Spigot-Server-Patches/0177-Raise-string-limit-for-packet-serialization.patch diff --git a/Spigot-Server-Patches/0177-Raise-string-limit-for-packet-serialization.patch b/Spigot-Server-Patches/0177-Raise-string-limit-for-packet-serialization.patch new file mode 100644 index 0000000000..b4aaccd8dc --- /dev/null +++ b/Spigot-Server-Patches/0177-Raise-string-limit-for-packet-serialization.patch @@ -0,0 +1,27 @@ +From bf6bbe6de6123f41a7a3b879bef3bfa0be290e24 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Wed, 21 Sep 2016 23:54:20 -0400 +Subject: [PATCH] Raise string limit for packet serialization + +The default limit is possible to hit with 50 page books with color codes, causing clients to disconnect. + +Bump the limit up a hair to above currently seen sizes. + +diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java +index b056457..662bd1e 100644 +--- a/src/main/java/net/minecraft/server/PacketDataSerializer.java ++++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java +@@ -298,8 +298,8 @@ public class PacketDataSerializer extends ByteBuf { + public PacketDataSerializer a(String s) { + byte[] abyte = s.getBytes(Charsets.UTF_8); + +- if (abyte.length > 32767) { +- throw new EncoderException("String too big (was " + s.length() + " bytes encoded, max " + 32767 + ")"); ++ if (abyte.length > 44767) { // Paper - raise limit a bit more as normal means can trigger this ++ throw new EncoderException("String too big (was " + s.length() + " bytes encoded, max " + 44767 + ")"); // Paper + } else { + this.d(abyte.length); + this.writeBytes(abyte); +-- +2.9.3 +