Fix timelimit causing an infinite map ending loop

A negative timelimit value or a value that would overflow the
multiplication by 60000 caused an endless map change/reload.

Based on patch and description by @vloup.
This commit is contained in:
Zack Middleton 2018-02-04 09:00:08 -06:00
parent 83119a990a
commit 0822772ea2

View file

@ -1366,6 +1366,12 @@ void CheckExitRules( void ) {
return;
}
if ( g_timelimit.integer < 0 || g_timelimit.integer > INT_MAX / 60000 ) {
G_Printf( "timelimit %i is out of range, defaulting to 0\n", g_timelimit.integer );
trap_Cvar_Set( "timelimit", "0" );
trap_Cvar_Update( &g_timelimit );
}
if ( g_timelimit.integer && !level.warmupTime ) {
if ( level.time - level.startTime >= g_timelimit.integer*60000 ) {
trap_SendServerCommand( -1, "print \"Timelimit hit.\n\"");