Don't allow too many arguments to be sent to the map command (#673)

`map` should only take a single arg that specifies the map to load.
This commit is contained in:
Jack 2024-03-02 14:29:58 +00:00 committed by GitHub
parent 026adbebe5
commit e1eb2a6f4b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 1 deletions

View File

@ -200,7 +200,13 @@ AUTOHOOK(Host_Map_f, engine.dll + 0x15B340, void, __fastcall, (const CCommand& a
{
RefreshMapList();
if (args.ArgC() > 1 &&
if (args.ArgC() > 2)
{
spdlog::warn("Map load failed: too many arguments provided");
return;
}
else if (
args.ArgC() == 2 &&
std::find_if(vMapList.begin(), vMapList.end(), [&](MapVPKInfo map) -> bool { return map.name == args.Arg(1); }) == vMapList.end())
{
spdlog::warn("Map load failed: {} not found or invalid", args.Arg(1));