Server validates the cursor positions clients send for a console command before using them!

This commit is contained in:
Joonas Rikkonen
2018-07-20 01:09:55 +03:00
parent f822e77241
commit 9e69216c52
@@ -1985,6 +1985,13 @@ namespace Barotrauma
return; return;
} }
if (!MathUtils.IsValid(cursorWorldPos))
{
GameMain.Server.SendConsoleMessage("Could not execute command \"" + command + "\" - invalid cursor position.", client);
NewMessage(client.Name + " attempted to execute the console command \"" + command + "\" with invalid cursor position.", Color.White);
return;
}
try try
{ {
matchingCommand.ServerExecuteOnClientRequest(client, cursorWorldPos, splitCommand.Skip(1).ToArray()); matchingCommand.ServerExecuteOnClientRequest(client, cursorWorldPos, splitCommand.Skip(1).ToArray());