Engine: fix out of bound access

Even though this is handles by the class, it really shouldn't happen.
This commit is contained in:
Kawe Mazidjatari 2024-01-21 21:53:48 +01:00
parent 1361bfb172
commit f6e6e7c30b

View File

@ -250,12 +250,17 @@ Host_Changelevel_f
*/
void Host_Changelevel_f(const CCommand& args)
{
if (args.ArgC() >= 2
const int argCount = args.ArgC();
if (argCount >= 2
&& IsOriginInitialized()
&& g_pServer->IsActive())
{
const char* levelName = args[1];
const char* landMarkName = argCount > 2 ? args[2] : "";
v_SetLaunchOptions(args);
v_HostState_ChangeLevelMP(args[1], args[2]);
v_HostState_ChangeLevelMP(levelName, landMarkName);
}
}
@ -399,6 +404,11 @@ Pak_Swap_f
*/
void Pak_Swap_f(const CCommand& args)
{
if (args.ArgC() < 2)
{
return;
}
const char* pakName = nullptr;
PakHandle_t pakHandle = INVALID_PAK_HANDLE;