Added check to HandleNpcTalk to ensure the passed NPC index is within

bounds (>= -1 && < `Main.maxNPCs`).
This commit is contained in:
James Puleo 2021-12-02 09:37:17 -05:00
parent ce056f1ce5
commit 97f33fea63
No known key found for this signature in database
GPG key ID: 3E16C7EFA34FB15D
2 changed files with 10 additions and 2 deletions

View file

@ -3160,9 +3160,16 @@ namespace TShockAPI
TShock.Log.ConsoleDebug("Bouncer / HandleNpcTalk rejected from bouncer throttle from {0}", args.Player.Name);
return true;
}
// -1 is a magic value, represents not talking to an NPC
if (npc < -1 || npc >= Main.maxNPCs)
{
TShock.Log.ConsoleDebug("Bouncer / HandleNpcTalk rejected from bouncer out of bounds from {0}", args.Player.Name);
return true;
}
return false;
}
}
private static bool HandlePlayerAnimation(GetDataHandlerArgs args)
{
if (OnPlayerAnimation(args.Player, args.Data))