summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Millwood <thebenmachine@gmail.com>2011-02-19 15:33:42 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:18:00 +0000
commit99ea876ed85f3e6bff53960ad861a35505ada9c2 (patch)
tree3536c7ba97cd3f8c51c21eaf2ab701206f8a8c47 /src
parenta2241e85481fd692a57dcb364f780f98f035ba4c (diff)
* Prevent overflow in /give funds
Diffstat (limited to 'src')
-rw-r--r--src/game/g_cmds.c5
1 files changed, 3 insertions, 2 deletions
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 );
}