Make MinecraftDecoder a MessageToMessageDecoder

This commit is contained in:
md_5 2015-05-18 20:16:00 +10:00
parent 93959cab4b
commit ddfd76ebda
2 changed files with 6 additions and 2 deletions

View File

@ -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<ByteBuf>
{
@Setter

View File

@ -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 )
{