Fix some modded clients getting kicked for invalid payload - Fixes #4201

This commit is contained in:
Aikar 2020-08-25 20:03:24 -04:00
parent 9a12d91631
commit 1622581fc9

View File

@ -40,8 +40,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
packetplayincustompayload.data.readBytes(data);
+
+ // Paper start - Brand support
+ if (packetplayincustompayload.tag.equals(MINECRAFT_BRAND))
+ this.clientBrandName = new PacketDataSerializer(Unpooled.copiedBuffer(data)).readUTF(256);
+ if (packetplayincustompayload.tag.equals(MINECRAFT_BRAND)) {
+ this.clientBrandName = data.length < 512 ? new String(data) : "unknown-too-large";
+ }
+ // Paper end
server.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packetplayincustompayload.tag.toString(), data);
} catch (Exception ex) {