#3268: Correct plugin message size check
This commit is contained in:
parent
978e68fc74
commit
410f64bc9f
@ -60,8 +60,8 @@ public class PluginMessage extends DefinedPacket
|
||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
tag = ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 ) ? MODERNISE.apply( readString( buf ) ) : readString( buf, 20 );
|
||||
int maxSize = direction == ProtocolConstants.Direction.TO_SERVER ? Short.MAX_VALUE : 0x100000;
|
||||
Preconditions.checkArgument( buf.readableBytes() < maxSize );
|
||||
int maxSize = ( direction == ProtocolConstants.Direction.TO_SERVER ) ? Short.MAX_VALUE : 0x100000;
|
||||
Preconditions.checkArgument( buf.readableBytes() <= maxSize, "Payload too large" );
|
||||
data = new byte[ buf.readableBytes() ];
|
||||
buf.readBytes( data );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user