summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-05-03 12:07:49 +0200
committerPaweł Redman <pawel.redman@gmail.com>2017-05-03 12:07:49 +0200
commit36f8fc13c89ea751456a17be1ec4b5d2110d44c0 (patch)
tree0219595a2fe0b2b04094abcdaf1ab5fbca890f72 /src/game
parentf6bb5ea062f5ff3d83fc9e73e20487d7f7334c04 (diff)
Fix undefined behavior in the high admin chat.
/ha and /say_hadmins were missing the permission check and using them as a non-high-admin would cause garbled text to be sent to high admins.
Diffstat (limited to 'src/game')
-rw-r--r--src/game/g_cmds.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 1c96ede..8203454 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -1171,15 +1171,12 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText )
color = COLOR_MAGENTA;
}
break;
-
+
case SAY_HADMINS:
- if( G_admin_permission( ent, ADMF_HIGHADMINCHAT ) )
- {
- G_LogPrintf( "say_hadmins: ^7[^1HIGH ADMIN^7]%s^7: %s^7\n", ( ent ) ? ent->client->pers.netname : "console", chatText );
- Com_sprintf( name, sizeof( name ), "%s^7[^1HIGH ADMIN^7]%s%c%c"EC": ", prefix,
- ( ent ) ? ent->client->pers.netname : "console", Q_COLOR_ESCAPE, COLOR_WHITE );
- color = COLOR_WHITE;
- }
+ G_LogPrintf( "say_hadmins: ^7[^1HIGH ADMIN^7]%s^7: %s^7\n", ( ent ) ? ent->client->pers.netname : "console", chatText );
+ Com_sprintf( name, sizeof( name ), "%s^7[^1HIGH ADMIN^7]%s%c%c"EC": ", prefix,
+ ( ent ) ? ent->client->pers.netname : "console", Q_COLOR_ESCAPE, COLOR_WHITE );
+ color = COLOR_WHITE;
break;
}
@@ -1351,16 +1348,21 @@ static void Cmd_Say_f( gentity_t *ent )
}
}
- if( ( !Q_stricmpn( args, "say /ha ", 8) ||
+ if( !Q_stricmpn( args, "say /ha ", 8) ||
!Q_stricmpn( args, "say_team /ha ", 13) ||
!Q_stricmpn( args, "say /say_hadmins ", 17) ||
!Q_stricmpn( args, "say_team /say_hadmins ", 22) )
- && G_admin_permission( ent, ADMF_HIGHADMINCHAT ) )
{
mode = SAY_HADMINS;
skipargs=1;
}
+ if( mode == SAY_HADMINS && !G_admin_permission( ent, ADMF_HIGHADMINCHAT ) )
+ {
+ ADMP( "You don't have the permission to use the high admin chat.\n" );
+ return;
+ }
+
if(!Q_stricmpn( args, "say /me ", 8 ) )
{
if( g_actionPrefix.string[0] )