cleanup Com_sprintf, minor tuning

This commit is contained in:
svdijk 2013-05-18 19:01:23 +02:00
parent 6472514c8f
commit 5692388da1
2 changed files with 3 additions and 10 deletions

View file

@ -1100,22 +1100,15 @@ Com_sprintf(char *dest, int size, char *fmt, ...)
{
int len;
va_list argptr;
static char bigbuffer[0x10000];
va_start(argptr, fmt);
len = vsnprintf(bigbuffer, 0x10000, fmt, argptr);
len = vsnprintf(dest, size, fmt, argptr);
va_end(argptr);
if ((len >= size) || (len == size))
if (len >= size)
{
Com_Printf("Com_sprintf: overflow\n");
dest = NULL;
return;
}
bigbuffer[size - 1] = '\0';
strcpy(dest, bigbuffer);
}
char *

View file

@ -1218,7 +1218,7 @@ Cmd_PlayerList_f(edict_t *ent)
if (strlen(text) + strlen(st) > sizeof(text) - 50)
{
sprintf(text + strlen(text), "And more...\n");
strcpy(text + strlen(text), "And more...\n");
gi.cprintf(ent, PRINT_HIGH, "%s", text);
return;
}