Skip to content

Commit

Permalink
Don't allow too many arguments to be sent to the map command (#673)
Browse files Browse the repository at this point in the history
`map` should only take a single arg that specifies the map to load.
  • Loading branch information
ASpoonPlaysGames committed Mar 2, 2024
1 parent 026adbe commit e1eb2a6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion primedev/util/printmaps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit e1eb2a6

Please sign in to comment.