From 4f133366e16893e5be42ad025ef911c2ee674c6f Mon Sep 17 00:00:00 2001 From: Myles Date: Sat, 12 Mar 2016 20:41:04 +0000 Subject: [PATCH] Add limitation to NBT data, we'll stick with this for now. I don't see this easily being beaten. --- src/main/java/us/myles/ViaVersion/util/PacketUtil.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/us/myles/ViaVersion/util/PacketUtil.java b/src/main/java/us/myles/ViaVersion/util/PacketUtil.java index a6922814e..c5e118510 100644 --- a/src/main/java/us/myles/ViaVersion/util/PacketUtil.java +++ b/src/main/java/us/myles/ViaVersion/util/PacketUtil.java @@ -42,6 +42,9 @@ public class PacketUtil { } public static CompoundTag readNBT(ByteBuf input) throws IOException { + // Default client is limited to 2097152 bytes. (2.09mb) + Preconditions.checkArgument(input.readableBytes() <= 2097152, "Cannot read NBT (got %s bytes)", input.readableBytes()); + int readerIndex = input.readerIndex(); byte b = input.readByte(); if (b == 0) {