diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java b/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java index b4312b6e3..f9610f57f 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java @@ -2,13 +2,13 @@ package net.md_5.bungee.protocol; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.ByteToMessageDecoder; +import io.netty.handler.codec.MessageToMessageDecoder; import java.util.List; import lombok.AllArgsConstructor; import lombok.Setter; @AllArgsConstructor -public class MinecraftDecoder extends ByteToMessageDecoder +public class MinecraftDecoder extends MessageToMessageDecoder { @Setter diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/Varint21FrameDecoder.java b/protocol/src/main/java/net/md_5/bungee/protocol/Varint21FrameDecoder.java index c8d75c352..0f3b5b65c 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/Varint21FrameDecoder.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/Varint21FrameDecoder.java @@ -29,6 +29,10 @@ public class Varint21FrameDecoder extends ByteToMessageDecoder if ( buf[i] >= 0 ) { int length = DefinedPacket.readVarInt( Unpooled.wrappedBuffer( buf ) ); + if ( length == 0 ) + { + throw new CorruptedFrameException( "Empty Packet!" ); + } if ( in.readableBytes() < length ) {