#3563: Correct max string length for reading SystemChat packets
This commit is contained in:
parent
16298a75f2
commit
0925c06f9b
@ -79,6 +79,11 @@ public abstract class DefinedPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static BaseComponent readBaseComponent(ByteBuf buf, int protocolVersion)
|
public static BaseComponent readBaseComponent(ByteBuf buf, int protocolVersion)
|
||||||
|
{
|
||||||
|
return readBaseComponent( buf, Short.MAX_VALUE, protocolVersion );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BaseComponent readBaseComponent(ByteBuf buf, int maxStringLength, int protocolVersion)
|
||||||
{
|
{
|
||||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_3 )
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_3 )
|
||||||
{
|
{
|
||||||
@ -88,7 +93,7 @@ public abstract class DefinedPacket
|
|||||||
return ComponentSerializer.deserialize( json );
|
return ComponentSerializer.deserialize( json );
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
String string = readString( buf );
|
String string = readString( buf, maxStringLength );
|
||||||
|
|
||||||
return ComponentSerializer.deserialize( string );
|
return ComponentSerializer.deserialize( string );
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ public class SystemChat extends DefinedPacket
|
|||||||
@Override
|
@Override
|
||||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||||
{
|
{
|
||||||
message = readBaseComponent( buf, protocolVersion );
|
message = readBaseComponent( buf, 262144, protocolVersion );
|
||||||
position = ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_1 ) ? ( ( buf.readBoolean() ) ? ChatMessageType.ACTION_BAR.ordinal() : 0 ) : readVarInt( buf );
|
position = ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_1 ) ? ( ( buf.readBoolean() ) ? ChatMessageType.ACTION_BAR.ordinal() : 0 ) : readVarInt( buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user