mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-06 07:32:07 +01:00
Fix reading the brand message from clients
Also try to catch the exception caused by clients/plugins seemingly mangling this information
This commit is contained in:
parent
5591eeb4c2
commit
c02f7541d2
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user