diff options
author | thilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2008-03-25 21:36:09 +0000 |
---|---|---|
committer | thilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2008-03-25 21:36:09 +0000 |
commit | dac8a746a7f80b50834e750927335d8d1a00c1c1 (patch) | |
tree | 461e51086bf9daff9b03fdf6caf4513f19bff772 /code/qcommon/q_shared.c | |
parent | 37e48fb6ad3a6081c6bf226021b2aa30ad09673c (diff) | |
download | ioquake3-aero-dac8a746a7f80b50834e750927335d8d1a00c1c1.tar.gz ioquake3-aero-dac8a746a7f80b50834e750927335d8d1a00c1c1.zip |
- Replace vsprintf function in bg_lib.c with vsnprintf implementation started by Patrick Powell.
- Remove all calls to vsprintf in the engine and gamecode and replace them with calls to vsnprintf.
git-svn-id: svn://svn.icculus.org/quake3/trunk@1277 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/qcommon/q_shared.c')
-rw-r--r-- | code/qcommon/q_shared.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/code/qcommon/q_shared.c b/code/qcommon/q_shared.c index 81e4e80..5ce6bbf 100644 --- a/code/qcommon/q_shared.c +++ b/code/qcommon/q_shared.c @@ -295,7 +295,7 @@ void COM_ParseError( char *format, ... ) static char string[4096]; va_start (argptr, format); - vsprintf (string, format, argptr); + Q_vsnprintf (string, sizeof(string), format, argptr); va_end (argptr); Com_Printf("ERROR: %s, line %d: %s\n", com_parsename, com_lines, string); @@ -307,7 +307,7 @@ void COM_ParseWarning( char *format, ... ) static char string[4096]; va_start (argptr, format); - vsprintf (string, format, argptr); + Q_vsnprintf (string, sizeof(string), format, argptr); va_end (argptr); Com_Printf("WARNING: %s, line %d: %s\n", com_parsename, com_lines, string); @@ -928,7 +928,7 @@ void QDECL Com_sprintf( char *dest, int size, const char *fmt, ...) { char bigbuffer[32000]; // big, but small enough to fit in PPC stack va_start (argptr,fmt); - len = vsprintf (bigbuffer,fmt,argptr); + len = Q_vsnprintf (bigbuffer, sizeof(bigbuffer), fmt,argptr); va_end (argptr); if ( len >= sizeof( bigbuffer ) ) { Com_Error( ERR_FATAL, "Com_sprintf: overflowed bigbuffer" ); @@ -951,20 +951,19 @@ va does a varargs printf into a temp buffer, so I don't need to have varargs versions of all text functions. -FIXME: make this buffer size safe someday ============ */ char * QDECL va( char *format, ... ) { va_list argptr; - static char string[2][32000]; // in case va is called by nested functions - static int index = 0; - char *buf; + static char string[2][32000]; // in case va is called by nested functions + static int index = 0; + char *buf; buf = string[index & 1]; index++; va_start (argptr, format); - vsprintf (buf, format,argptr); + Q_vsnprintf (buf, sizeof(*string), format, argptr); va_end (argptr); return buf; |