From 99ea876ed85f3e6bff53960ad861a35505ada9c2 Mon Sep 17 00:00:00 2001 From: Ben Millwood Date: Sat, 19 Feb 2011 15:33:42 +0000 Subject: * Prevent overflow in /give funds --- src/game/g_cmds.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 330b5d94..47b65fbf 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -405,12 +405,13 @@ void Cmd_Give_f( gentity_t *ent ) if( give_all || Q_stricmpn( name, "funds", 5 ) == 0 ) { float credits = atof( name + 6 ); + const float max = MAX( ALIEN_MAX_CREDITS, HUMAN_MAX_CREDITS ); if( ent->client->pers.teamSelection == TEAM_ALIENS ) credits *= ALIEN_CREDITS_PER_KILL; - if( give_all ) - credits = ALIEN_MAX_CREDITS; + if( give_all || credits > max ) + credits = max; G_AddCreditToClient( ent->client, credits, qtrue ); } -- cgit