sprintf -> snprintf, vsprintf -> vsnprintf

This commit is contained in:
Danne 2000-05-20 10:27:34 +00:00
parent 68ca31e417
commit 37e42f35c6
3 changed files with 13 additions and 5 deletions

View file

@ -67,7 +67,11 @@ void Sys_Printf (char *fmt, ...)
char text[1024];
va_start (argptr,fmt);
vsprintf (text,fmt,argptr);
#ifdef HAVE_VSNPRINTF
vsnprintf (text,sizeof(text),fmt,argptr);
#else
vsprintf (text,fmt,argptr);
#endif
va_end (argptr);
fprintf(stderr, "%s", text);
@ -85,7 +89,11 @@ void Sys_Printf (char *fmt, ...)
return;
va_start (argptr,fmt);
#ifdef HAVE_VSNPRINTF
vsnprintf (text,sizeof(text),fmt,argptr);
#else
vsprintf (text,fmt,argptr);
#endif
va_end (argptr);
l = strlen(text);

View file

@ -640,7 +640,7 @@ void R_LoadSkys (char * skyname)
for (i=0 ; i<6 ; i++)
{
GL_Bind (SKY_TEX + i);
sprintf (name, "env/%s%s.tga", skyname, suf[i]);
snprintf (name, sizeof(name),"env/%s%s.tga", skyname, suf[i]);
COM_FOpenFile (name, &f);
if (!f)
{

View file

@ -795,7 +795,7 @@ void Key_Event (int key, qboolean down)
kb = keybindings[key];
if (kb && kb[0] == '+')
{
sprintf (cmd, "-%s %i\n", kb+1, key);
snprintf (cmd, sizeof(cmd), "-%s %i\n", kb+1, key);
Cbuf_AddText (cmd);
}
if (keyshift[key] != key)
@ -803,7 +803,7 @@ void Key_Event (int key, qboolean down)
kb = keybindings[keyshift[key]];
if (kb && kb[0] == '+')
{
sprintf (cmd, "-%s %i\n", kb+1, key);
snprintf (cmd, sizeof(cmd), "-%s %i\n", kb+1, key);
Cbuf_AddText (cmd);
}
}
@ -831,7 +831,7 @@ void Key_Event (int key, qboolean down)
{
if (kb[0] == '+')
{ // button commands add keynum as a parm
sprintf (cmd, "%s %i\n", kb, key);
snprintf (cmd, sizeof(cmd), "%s %i\n", kb, key);
Cbuf_AddText (cmd);
}
else