From e1eb2a6f4b858e903603226098861c3b62d5d1a4 Mon Sep 17 00:00:00 2001 From: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> Date: Sat, 2 Mar 2024 14:29:58 +0000 Subject: 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. --- primedev/util/printmaps.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'primedev') diff --git a/primedev/util/printmaps.cpp b/primedev/util/printmaps.cpp index 906bed06..28325db9 100644 --- a/primedev/util/printmaps.cpp +++ b/primedev/util/printmaps.cpp @@ -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)); -- cgit v1.2.3