Fix a crash exploit related to extremely long death messages or text
This commit is contained in:
parent
6a27d51261
commit
a81165026c
2 changed files with 14 additions and 4 deletions
|
|
@ -2501,15 +2501,18 @@ namespace TShockAPI
|
||||||
|
|
||||||
if (OnKillMe(id, direction, dmg, pvp))
|
if (OnKillMe(id, direction, dmg, pvp))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int textlength = (int) (args.Data.Length - args.Data.Position - 1);
|
int textlength = (int) (args.Data.Length - args.Data.Position - 1);
|
||||||
string deathtext = "";
|
string deathtext = "";
|
||||||
if (textlength > 0)
|
if (textlength > 0)
|
||||||
{
|
{
|
||||||
deathtext = Encoding.UTF8.GetString(args.Data.ReadBytes(textlength));
|
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;
|
args.Player.LastDeath = DateTime.Now;
|
||||||
|
|
|
||||||
|
|
@ -950,6 +950,13 @@ namespace TShockAPI
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.Text.Length > 500)
|
||||||
|
{
|
||||||
|
Utils.Kick(tsplr, "Crash attempt", true);
|
||||||
|
args.Handled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*if (!Utils.ValidString(text))
|
/*if (!Utils.ValidString(text))
|
||||||
{
|
{
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue