mirror of
https://github.com/yquake2/rogue.git
synced 2024-11-10 14:52:05 +00:00
Investigated PVS report for g_cmds and use snprintf instead of sprintf
This commit is contained in:
parent
81e59effff
commit
b7f6d9da91
1 changed files with 6 additions and 4 deletions
10
src/g_cmds.c
10
src/g_cmds.c
|
@ -1224,7 +1224,7 @@ Cmd_Ent_Count_f(edict_t *ent)
|
|||
void
|
||||
Cmd_PlayerList_f(edict_t *ent)
|
||||
{
|
||||
int i;
|
||||
int i, text_len;
|
||||
char st[80];
|
||||
char text[1400];
|
||||
edict_t *e2;
|
||||
|
@ -1235,7 +1235,7 @@ Cmd_PlayerList_f(edict_t *ent)
|
|||
}
|
||||
|
||||
/* connect time, ping, score, name */
|
||||
*text = 0;
|
||||
*text = '\0';
|
||||
|
||||
for (i = 0, e2 = g_edicts + 1; i < maxclients->value; i++, e2++)
|
||||
{
|
||||
|
@ -1251,9 +1251,11 @@ Cmd_PlayerList_f(edict_t *ent)
|
|||
e2->client->pers.netname,
|
||||
e2->client->resp.spectator ? " (spectator)" : "");
|
||||
|
||||
if (strlen(text) + strlen(st) > sizeof(text) - 50)
|
||||
text_len = strlen(text);
|
||||
|
||||
if ((text_len + strlen(st)) > (sizeof(text) - 50))
|
||||
{
|
||||
sprintf(text + strlen(text), "And more...\n");
|
||||
snprintf(text + text_len, sizeof(text) - text_len, "And more...\n");
|
||||
gi.cprintf(ent, PRINT_HIGH, "%s", text);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue