From 37e42f35c6bc4f6b3db526678738c7d09ecf9fbc Mon Sep 17 00:00:00 2001 From: Danne Date: Sat, 20 May 2000 10:27:34 +0000 Subject: [PATCH] sprintf -> snprintf, vsprintf -> vsnprintf --- source/cl_sys_unix.c | 10 +++++++++- source/gl_warp.c | 2 +- source/keys.c | 6 +++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/source/cl_sys_unix.c b/source/cl_sys_unix.c index 830bc88..6e3afaa 100644 --- a/source/cl_sys_unix.c +++ b/source/cl_sys_unix.c @@ -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); diff --git a/source/gl_warp.c b/source/gl_warp.c index 780562c..d915ba3 100644 --- a/source/gl_warp.c +++ b/source/gl_warp.c @@ -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) { diff --git a/source/keys.c b/source/keys.c index 360d548..16e0b53 100644 --- a/source/keys.c +++ b/source/keys.c @@ -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