mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-22 04:31:09 +00:00
Lets not do the last two commits just before 5.11
Revert "change several strcat calls to Q_strlcat calls" This reverts commitab879f1bc7
. Revert "change (v)sprintf calls to (v)snprintf calls" This reverts commitb46e210d76
.
This commit is contained in:
parent
ab879f1bc7
commit
6472514c8f
25 changed files with 66 additions and 61 deletions
|
@ -346,9 +346,9 @@ VID_CheckChanges(void)
|
|||
cls.disable_screen = true;
|
||||
|
||||
#ifdef _WIN32
|
||||
snprintf(name, sizeof(name), "ref_%s.dll", vid_ref->string);
|
||||
sprintf(name, "ref_%s.dll", vid_ref->string);
|
||||
#else
|
||||
snprintf(name, sizeof(name), "ref_%s.so", vid_ref->string);
|
||||
sprintf(name, "ref_%s.so", vid_ref->string);
|
||||
#endif
|
||||
|
||||
if (!VID_LoadRefresh(name))
|
||||
|
|
|
@ -839,7 +839,7 @@ NET_Socket(char *net_interface, int port, netsrc_t type, int family)
|
|||
}
|
||||
else
|
||||
{
|
||||
snprintf(Buf, sizeof(Buf), "%5d", port);
|
||||
sprintf(Buf, "%5d", port);
|
||||
Service = Buf;
|
||||
}
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ Sys_FindFirst(char *path, unsigned musthave, unsigned canhave)
|
|||
{
|
||||
if (CompareAttributes(findbase, d->d_name, musthave, canhave))
|
||||
{
|
||||
snprintf(findpath, sizeof(findpath), "%s/%s", findbase, d->d_name);
|
||||
sprintf(findpath, "%s/%s", findbase, d->d_name);
|
||||
return findpath;
|
||||
}
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ Sys_FindNext(unsigned musthave, unsigned canhave)
|
|||
{
|
||||
if (CompareAttributes(findbase, d->d_name, musthave, canhave))
|
||||
{
|
||||
snprintf(findpath, sizeof(findpath), "%s/%s", findbase, d->d_name);
|
||||
sprintf(findpath, "%s/%s", findbase, d->d_name);
|
||||
return findpath;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -834,7 +834,7 @@ NET_IPSocket(char *net_interface, int port, netsrc_t type, int family)
|
|||
}
|
||||
else
|
||||
{
|
||||
snprintf(Buf, sizeof(Buf), "%5d", port);
|
||||
sprintf(Buf, "%5d", port);
|
||||
Service = Buf;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ Sys_Error(char *error, ...)
|
|||
Qcommon_Shutdown();
|
||||
|
||||
va_start(argptr, error);
|
||||
vsnprintf(text, sizeof(text), error, argptr);
|
||||
vsprintf(text, error, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
#ifndef DEDICATED_ONLY
|
||||
|
|
|
@ -449,7 +449,7 @@ Con_CenteredPrint(char *text)
|
|||
|
||||
memset(buffer, ' ', l);
|
||||
strcpy(buffer + l, text);
|
||||
Q_strlcat(buffer, "\n", sizeof(buffer));
|
||||
strcat(buffer, "\n");
|
||||
Con_Print(buffer);
|
||||
}
|
||||
|
||||
|
@ -704,14 +704,14 @@ Con_DrawConsole(float frac)
|
|||
y = x - i - 11;
|
||||
memcpy(dlbar, text, i);
|
||||
dlbar[i] = 0;
|
||||
Q_strlcat(dlbar, "...", sizeof(dlbar));
|
||||
strcat(dlbar, "...");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(dlbar, text);
|
||||
}
|
||||
|
||||
Q_strlcat(dlbar, ": ", sizeof(dlbar));
|
||||
strcat(dlbar, ": ");
|
||||
i = strlen(dlbar);
|
||||
dlbar[i++] = '\x80';
|
||||
|
||||
|
@ -742,7 +742,7 @@ Con_DrawConsole(float frac)
|
|||
dlbar[i++] = '\x82';
|
||||
dlbar[i] = 0;
|
||||
|
||||
snprintf(dlbar + i, sizeof(dlbar) - i, " %02d%%", cls.downloadpercent);
|
||||
sprintf(dlbar + strlen(dlbar), " %02d%%", cls.downloadpercent);
|
||||
|
||||
/* draw it */
|
||||
y = con.vislines - 12;
|
||||
|
|
|
@ -399,7 +399,7 @@ CL_RequestNextDownload(void)
|
|||
{
|
||||
char fn[MAX_OSPATH];
|
||||
|
||||
snprintf(fn, sizeof(fn), "textures/%s.wal",
|
||||
sprintf(fn, "textures/%s.wal",
|
||||
map_surfaces[precache_tex++].rname);
|
||||
|
||||
if (!CL_CheckOrDownloadFile(fn))
|
||||
|
@ -469,7 +469,7 @@ CL_CheckOrDownloadFile(char *filename)
|
|||
to the real name when done, so if interrupted
|
||||
a runt file wont be left */
|
||||
COM_StripExtension(cls.downloadname, cls.downloadtempname);
|
||||
Q_strlcat(cls.downloadtempname, ".tmp", sizeof(cls.downloadtempname));
|
||||
strcat(cls.downloadtempname, ".tmp");
|
||||
|
||||
/* check to see if we already have a tmp for this
|
||||
file, if so, try to resume and open the file if
|
||||
|
@ -540,7 +540,7 @@ CL_Download_f(void)
|
|||
to the real name when done, so if interrupted
|
||||
a runt file wont be left */
|
||||
COM_StripExtension(cls.downloadname, cls.downloadtempname);
|
||||
Q_strlcat(cls.downloadtempname, ".tmp", sizeof(cls.downloadtempname));
|
||||
strcat(cls.downloadtempname, ".tmp");
|
||||
|
||||
MSG_WriteByte(&cls.netchan.message, clc_stringcmd);
|
||||
MSG_WriteString(&cls.netchan.message, va("download %s", cls.downloadname));
|
||||
|
|
|
@ -743,11 +743,11 @@ Key_Bind_f(void)
|
|||
|
||||
for (i = 2; i < c; i++)
|
||||
{
|
||||
Q_strlcat(cmd, Cmd_Argv(i), sizeof(cmd));
|
||||
strcat(cmd, Cmd_Argv(i));
|
||||
|
||||
if (i != (c - 1))
|
||||
{
|
||||
Q_strlcat(cmd, " ", sizeof(cmd));
|
||||
strcat(cmd, " ");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -277,12 +277,12 @@ CL_Setenv_f(void)
|
|||
int i;
|
||||
|
||||
strcpy(buffer, Cmd_Argv(1));
|
||||
Q_strlcat(buffer, "=", sizeof(buffer));
|
||||
strcat(buffer, "=");
|
||||
|
||||
for (i = 2; i < argc; i++)
|
||||
{
|
||||
Q_strlcat(buffer, Cmd_Argv(i), sizeof(buffer));
|
||||
Q_strlcat(buffer, " ", sizeof(buffer));
|
||||
strcat(buffer, Cmd_Argv(i));
|
||||
strcat(buffer, " ");
|
||||
}
|
||||
|
||||
putenv(buffer);
|
||||
|
|
|
@ -247,15 +247,15 @@ CL_Rcon_f(void)
|
|||
|
||||
NET_Config(true); /* allow remote */
|
||||
|
||||
Q_strlcat(message, "rcon ", sizeof(message));
|
||||
strcat(message, "rcon ");
|
||||
|
||||
Q_strlcat(message, rcon_client_password->string, sizeof(message));
|
||||
Q_strlcat(message, " ", sizeof(message));
|
||||
strcat(message, rcon_client_password->string);
|
||||
strcat(message, " ");
|
||||
|
||||
for (i = 1; i < Cmd_Argc(); i++)
|
||||
{
|
||||
Q_strlcat(message, Cmd_Argv(i), sizeof(message));
|
||||
Q_strlcat(message, " ", sizeof(message));
|
||||
strcat(message, Cmd_Argv(i));
|
||||
strcat(message, " ");
|
||||
}
|
||||
|
||||
if (cls.state >= ca_connected)
|
||||
|
|
|
@ -1184,7 +1184,7 @@ SCR_ExecuteLayoutString(char *s)
|
|||
ping = 999;
|
||||
}
|
||||
|
||||
snprintf(block, sizeof(block), "%3d %3d %-12.12s", score, ping, ci->name);
|
||||
sprintf(block, "%3d %3d %-12.12s", score, ping, ci->name);
|
||||
|
||||
if (value == cl.playernum)
|
||||
{
|
||||
|
@ -1508,7 +1508,7 @@ SCR_UpdateScreen(void)
|
|||
if (cl_drawfps->value)
|
||||
{
|
||||
char s[8];
|
||||
snprintf(s, sizeof(s), "%3.0ffps", 1 / cls.frametime);
|
||||
sprintf(s, "%3.0ffps", 1 / cls.frametime);
|
||||
DrawString(viddef.width - 64, 0, s);
|
||||
}
|
||||
|
||||
|
|
|
@ -549,7 +549,7 @@ M_Main_Draw(void)
|
|||
}
|
||||
|
||||
strcpy(litname, names[m_main_cursor]);
|
||||
Q_strlcat(litname, "_sel", sizeof(litname));
|
||||
strcat(litname, "_sel");
|
||||
re.DrawPic(xoffset, ystart + m_main_cursor * 40 + 13, litname);
|
||||
|
||||
M_DrawCursor(xoffset - 25, ystart + m_main_cursor * 40 + 11,
|
||||
|
@ -3784,7 +3784,7 @@ IconOfSkinExists(char *skin, char **pcxfiles, int npcxfiles)
|
|||
|
||||
strcpy(scratch, skin);
|
||||
*strrchr(scratch, '.') = 0;
|
||||
Q_strlcat(scratch, "_i.pcx", sizeof(scratch));
|
||||
strcat(scratch, "_i.pcx");
|
||||
|
||||
for (i = 0; i < npcxfiles; i++)
|
||||
{
|
||||
|
@ -3862,7 +3862,7 @@ PlayerConfig_ScanDirectories(void)
|
|||
|
||||
/* verify the existence of tris.md2 */
|
||||
strcpy(scratch, dirnames[i]);
|
||||
Q_strlcat(scratch, "/tris.md2", sizeof(scratch));
|
||||
strcat(scratch, "/tris.md2");
|
||||
|
||||
if (!Sys_FindFirst(scratch, 0, SFF_SUBDIR | SFF_HIDDEN | SFF_SYSTEM))
|
||||
{
|
||||
|
@ -3876,7 +3876,7 @@ PlayerConfig_ScanDirectories(void)
|
|||
|
||||
/* verify the existence of at least one pcx skin */
|
||||
strcpy(scratch, dirnames[i]);
|
||||
Q_strlcat(scratch, "/*.pcx", sizeof(scratch));
|
||||
strcat(scratch, "/*.pcx");
|
||||
pcxnames = FS_ListFiles(scratch, &npcxfiles,
|
||||
0, SFF_SUBDIR | SFF_HIDDEN | SFF_SYSTEM);
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ Com_Printf(char *fmt, ...)
|
|||
*rd_buffer = 0;
|
||||
}
|
||||
|
||||
Q_strlcat(rd_buffer, msg, rd_buffersize);
|
||||
strcat(rd_buffer, msg);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -460,15 +460,15 @@ Cmd_Alias_f(void)
|
|||
|
||||
for (i = 2; i < c; i++)
|
||||
{
|
||||
Q_strlcat(cmd, Cmd_Argv(i), sizeof(cmd));
|
||||
strcat(cmd, Cmd_Argv(i));
|
||||
|
||||
if (i != (c - 1))
|
||||
{
|
||||
Q_strlcat(cmd, " ", sizeof(cmd));
|
||||
strcat(cmd, " ");
|
||||
}
|
||||
}
|
||||
|
||||
Q_strlcat(cmd, "\n", sizeof(cmd));
|
||||
strcat(cmd, "\n");
|
||||
|
||||
a->value = CopyString(cmd);
|
||||
}
|
||||
|
|
|
@ -1100,16 +1100,22 @@ Com_sprintf(char *dest, int size, char *fmt, ...)
|
|||
{
|
||||
int len;
|
||||
va_list argptr;
|
||||
static char bigbuffer[0x10000];
|
||||
|
||||
va_start(argptr, fmt);
|
||||
len = vsnprintf(dest, size, fmt, argptr);
|
||||
len = vsnprintf(bigbuffer, 0x10000, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
if (len >= size)
|
||||
if ((len >= size) || (len == size))
|
||||
{
|
||||
Com_Printf("Com_sprintf: overflow\n");
|
||||
|
||||
dest = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
bigbuffer[size - 1] = '\0';
|
||||
strcpy(dest, bigbuffer);
|
||||
}
|
||||
|
||||
char *
|
||||
|
|
|
@ -1096,9 +1096,9 @@ Cmd_Say_f(edict_t *ent, qboolean team, qboolean arg0)
|
|||
|
||||
if (arg0)
|
||||
{
|
||||
Q_strlcat(text, gi.argv(0), sizeof(text));
|
||||
Q_strlcat(text, " ", sizeof(text));
|
||||
Q_strlcat(text, gi.args(), sizeof(text));
|
||||
strcat(text, gi.argv(0));
|
||||
strcat(text, " ");
|
||||
strcat(text, gi.args());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1110,7 +1110,7 @@ Cmd_Say_f(edict_t *ent, qboolean team, qboolean arg0)
|
|||
p[strlen(p) - 1] = 0;
|
||||
}
|
||||
|
||||
Q_strlcat(text, p, sizeof(text));
|
||||
strcat(text, p);
|
||||
}
|
||||
|
||||
/* don't let text be too long for malicious reasons */
|
||||
|
@ -1119,7 +1119,7 @@ Cmd_Say_f(edict_t *ent, qboolean team, qboolean arg0)
|
|||
text[150] = 0;
|
||||
}
|
||||
|
||||
Q_strlcat(text, "\n", sizeof(text));
|
||||
strcat(text, "\n");
|
||||
|
||||
if (flood_msgs->value)
|
||||
{
|
||||
|
@ -1218,7 +1218,7 @@ Cmd_PlayerList_f(edict_t *ent)
|
|||
|
||||
if (strlen(text) + strlen(st) > sizeof(text) - 50)
|
||||
{
|
||||
strcat(text, "And more...\n");
|
||||
sprintf(text + strlen(text), "And more...\n");
|
||||
gi.cprintf(ent, PRINT_HIGH, "%s", text);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ Sys_Error(char *error, ...)
|
|||
char text[1024];
|
||||
|
||||
va_start(argptr, error);
|
||||
vsnprintf(text, sizeof(text), error, argptr);
|
||||
vsprintf(text, error, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
gi.error(ERR_FATAL, "%s", text);
|
||||
|
@ -169,7 +169,7 @@ Com_Printf(char *msg, ...)
|
|||
char text[1024];
|
||||
|
||||
va_start(argptr, msg);
|
||||
vsnprintf(text, sizeof(text), msg, argptr);
|
||||
vsprintf(text, msg, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
gi.dprintf("%s", text);
|
||||
|
|
|
@ -284,11 +284,11 @@ SVCmd_WriteIP_f(void)
|
|||
|
||||
if (!*game->string)
|
||||
{
|
||||
snprintf(name, sizeof(name), "%s/listip.cfg", GAMEVERSION);
|
||||
sprintf(name, "%s/listip.cfg", GAMEVERSION);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(name, sizeof(name), "%s/listip.cfg", game->string);
|
||||
sprintf(name, "%s/listip.cfg", game->string);
|
||||
}
|
||||
|
||||
gi.cprintf(NULL, PRINT_HIGH, "Writing %s.\n", name);
|
||||
|
|
|
@ -1637,7 +1637,7 @@ Sys_Error(char *error, ...)
|
|||
char text[1024];
|
||||
|
||||
va_start(argptr, error);
|
||||
vsnprintf(text, sizeof(text), error, argptr);
|
||||
vsprintf(text, error, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
ri.Sys_Error(ERR_FATAL, "%s", text);
|
||||
|
@ -1650,7 +1650,7 @@ Com_Printf(char *fmt, ...)
|
|||
char text[1024];
|
||||
|
||||
va_start(argptr, fmt);
|
||||
vsnprintf(text, sizeof(text), fmt, argptr);
|
||||
vsprintf(text, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
ri.Con_Printf(PRINT_ALL, "%s", text);
|
||||
|
|
|
@ -408,7 +408,7 @@ SV_ConSay_f(void)
|
|||
p[strlen(p) - 1] = 0;
|
||||
}
|
||||
|
||||
Q_strlcat(text, p, sizeof(text));
|
||||
strcat(text, p);
|
||||
|
||||
for (j = 0, client = svs.clients; j < maxclients->value; j++, client++)
|
||||
{
|
||||
|
|
|
@ -368,8 +368,8 @@ SVC_RemoteCommand(void)
|
|||
|
||||
for (i = 2; i < Cmd_Argc(); i++)
|
||||
{
|
||||
Q_strlcat(remaining, Cmd_Argv(i), sizeof(remaining));
|
||||
Q_strlcat(remaining, " ", sizeof(remaining));
|
||||
strcat(remaining, Cmd_Argv(i));
|
||||
strcat(remaining, " ");
|
||||
}
|
||||
|
||||
Cmd_ExecuteString(remaining);
|
||||
|
|
|
@ -78,7 +78,7 @@ PF_dprintf(char *fmt, ...)
|
|||
va_list argptr;
|
||||
|
||||
va_start(argptr, fmt);
|
||||
vsnprintf(msg, sizeof(msg), fmt, argptr);
|
||||
vsprintf(msg, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
Com_Printf("%s", msg);
|
||||
|
@ -107,7 +107,7 @@ PF_cprintf(edict_t *ent, int level, char *fmt, ...)
|
|||
}
|
||||
|
||||
va_start(argptr, fmt);
|
||||
vsnprintf(msg, sizeof(msg), fmt, argptr);
|
||||
vsprintf(msg, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
if (ent)
|
||||
|
@ -138,7 +138,7 @@ PF_centerprintf(edict_t *ent, char *fmt, ...)
|
|||
}
|
||||
|
||||
va_start(argptr, fmt);
|
||||
vsnprintf(msg, sizeof(msg), fmt, argptr);
|
||||
vsprintf(msg, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
MSG_WriteByte(&sv.multicast, svc_centerprint);
|
||||
|
@ -156,7 +156,7 @@ PF_error(char *fmt, ...)
|
|||
va_list argptr;
|
||||
|
||||
va_start(argptr, fmt);
|
||||
vsnprintf(msg, sizeof(msg), fmt, argptr);
|
||||
vsprintf(msg, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
Com_Error(ERR_DROP, "Game Error: %s", msg);
|
||||
|
|
|
@ -212,8 +212,7 @@ SV_SpawnServer(char *server, char *spawnpoint, server_state_t serverstate,
|
|||
|
||||
if (Cvar_VariableValue("deathmatch"))
|
||||
{
|
||||
snprintf(sv.configstrings[CS_AIRACCEL], sizeof(sv.configstrings[CS_AIRACCEL]),
|
||||
"%g", sv_airaccelerate->value);
|
||||
sprintf(sv.configstrings[CS_AIRACCEL], "%g", sv_airaccelerate->value);
|
||||
pm_airaccelerate = sv_airaccelerate->value;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -95,7 +95,7 @@ SV_StatusString(void)
|
|||
int playerLength;
|
||||
|
||||
strcpy(status, Cvar_Serverinfo());
|
||||
Q_strlcat(status, "\n", sizeof(status));
|
||||
strcat(status, "\n");
|
||||
statusLength = (int)strlen(status);
|
||||
|
||||
for (i = 0; i < maxclients->value; i++)
|
||||
|
|
|
@ -58,7 +58,7 @@ SV_ClientPrintf(client_t *cl, int level, char *fmt, ...)
|
|||
}
|
||||
|
||||
va_start(argptr, fmt);
|
||||
vsnprintf(string, sizeof(string), fmt, argptr);
|
||||
vsprintf(string, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
MSG_WriteByte(&cl->netchan.message, svc_print);
|
||||
|
@ -78,7 +78,7 @@ SV_BroadcastPrintf(int level, char *fmt, ...)
|
|||
int i;
|
||||
|
||||
va_start(argptr, fmt);
|
||||
vsnprintf(string, sizeof(string), fmt, argptr);
|
||||
vsprintf(string, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
/* echo to console */
|
||||
|
@ -130,7 +130,7 @@ SV_BroadcastCommand(char *fmt, ...)
|
|||
}
|
||||
|
||||
va_start(argptr, fmt);
|
||||
vsnprintf(string, sizeof(string), fmt, argptr);
|
||||
vsprintf(string, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
MSG_WriteByte(&sv.multicast, svc_stufftext);
|
||||
|
|
Loading…
Reference in a new issue