diff options
Diffstat (limited to 'nms-patches/PacketDataSerializer.patch')
-rw-r--r-- | nms-patches/PacketDataSerializer.patch | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/nms-patches/PacketDataSerializer.patch b/nms-patches/PacketDataSerializer.patch index d15d36df..e77b2e14 100644 --- a/nms-patches/PacketDataSerializer.patch +++ b/nms-patches/PacketDataSerializer.patch @@ -13,25 +13,7 @@ public PacketDataSerializer(ByteBuf bytebuf) { this.a = bytebuf; -@@ -44,8 +47,16 @@ - return this; - } - -+ // CraftBukkit start - limit length - public byte[] a() { -- byte[] abyte = new byte[this.g()]; -+ return readByteArray(Short.MAX_VALUE); -+ } -+ -+ public byte[] readByteArray(int limit) { -+ int len = this.g(); -+ if (len > limit) throw new DecoderException("The received a byte array longer than allowed " + len + " > " + limit); -+ byte[] abyte = new byte[len]; -+ // CraftBukkit end - - this.readBytes(abyte); - return abyte; -@@ -99,7 +110,7 @@ +@@ -119,7 +122,7 @@ } public <T extends Enum<T>> T a(Class<T> oclass) { @@ -40,7 +22,7 @@ } public PacketDataSerializer a(Enum<?> oenum) { -@@ -176,7 +187,7 @@ +@@ -196,7 +199,7 @@ } else { try { NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) (new ByteBufOutputStream(this))); @@ -49,7 +31,7 @@ throw new EncoderException(ioexception); } } -@@ -202,7 +213,7 @@ +@@ -222,7 +225,7 @@ } public PacketDataSerializer a(ItemStack itemstack) { @@ -58,7 +40,7 @@ this.writeShort(-1); } else { this.writeShort(Item.getId(itemstack.getItem())); -@@ -230,6 +241,11 @@ +@@ -250,6 +253,11 @@ itemstack = new ItemStack(Item.getById(short0), b0, short1); itemstack.setTag(this.j()); |