From c02f7541d2efe093639f4b9745a0515739852390 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Thu, 27 Aug 2020 17:11:13 +0100 Subject: [PATCH] Fix reading the brand message from clients Also try to catch the exception caused by clients/plugins seemingly mangling this information --- Spigot-Server-Patches/0554-Brand-support.patch | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Spigot-Server-Patches/0554-Brand-support.patch b/Spigot-Server-Patches/0554-Brand-support.patch index 5fd277c70..3683eb17a 100644 --- a/Spigot-Server-Patches/0554-Brand-support.patch +++ b/Spigot-Server-Patches/0554-Brand-support.patch @@ -41,7 +41,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + // Paper start - Brand support + if (packetplayincustompayload.tag.equals(MINECRAFT_BRAND)) { -+ this.clientBrandName = data.length < 512 ? new String(data) : "unknown-too-large"; ++ try { ++ this.clientBrandName = new PacketDataSerializer(Unpooled.copiedBuffer(data)).readUTF(256); ++ } catch (StringIndexOutOfBoundsException ex) { ++ this.clientBrandName = "illegal"; ++ } + } + // Paper end server.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packetplayincustompayload.tag.toString(), data);