Never send back too large tile rects in handling

This commit is contained in:
punchready 2023-04-04 06:16:44 +02:00
parent 26482da23f
commit d0409db5fb

View file

@ -416,6 +416,16 @@ namespace TShockAPI.Handlers
// this handler handles the entire logic of this packet
args.Handled = true;
// as of 1.4 this is the biggest size the client will send in any case, determined by full code analysis
// see default matches above and special cases below
if (args.Width > 4 || args.Length > 4)
{
TShock.Log.ConsoleDebug(GetString($"Bouncer / SendTileRect rejected from size from {args.Player.Name}"));
// definitely invalid; do not send any correcting data
return;
}
// player throttled?
if (args.Player.IsBouncerThrottled())
{
@ -436,16 +446,6 @@ namespace TShockAPI.Handlers
return;
}
// as of 1.4 this is the biggest size the client will send in any case, determined by full code analysis
// see default matches above and special cases below
if (args.Width > 4 || args.Length > 4)
{
TShock.Log.ConsoleDebug(GetString($"Bouncer / SendTileRect rejected from non-vanilla tilemod from {args.Player.Name}"));
// definitely invalid; do not send any correcting data
return;
}
// read the tile rectangle
TileRect rect = TileRect.Read(args.Data, args.TileX, args.TileY, args.Width, args.Length);