Fix a crash exploit related to extremely long death messages or text

This commit is contained in:
MarioE 2013-10-20 14:31:54 -04:00
parent 6a27d51261
commit a81165026c
2 changed files with 14 additions and 4 deletions

View file

@ -2501,15 +2501,18 @@ namespace TShockAPI
if (OnKillMe(id, direction, dmg, pvp))
return true;
int textlength = (int) (args.Data.Length - args.Data.Position - 1);
string deathtext = "";
if (textlength > 0)
{
deathtext = Encoding.UTF8.GetString(args.Data.ReadBytes(textlength));
/*if (!TShock.Utils.ValidString(deathtext))
{
return true;
}*/
}
if (deathtext.Length > 500)
{
TShock.Utils.Kick(TShock.Players[id], "Crash attempt", true);
return true;
}
args.Player.LastDeath = DateTime.Now;

View file

@ -950,6 +950,13 @@ namespace TShockAPI
return;
}
if (args.Text.Length > 500)
{
Utils.Kick(tsplr, "Crash attempt", true);
args.Handled = true;
return;
}
/*if (!Utils.ValidString(text))
{
e.Handled = true;