Index: botlib/be_aas_main.c =================================================================== --- botlib/be_aas_main.c (revision 1897) +++ botlib/be_aas_main.c (working copy) @@ -62,6 +62,7 @@ va_start(arglist, fmt); Q_vsnprintf(str, sizeof(str), fmt, arglist); va_end(arglist); + ZLASTCHAR(str); botimport.Print(PRT_FATAL, "%s", str); } //end of the function AAS_Error //=========================================================================== Index: botlib/l_precomp.c =================================================================== --- botlib/l_precomp.c (revision 1897) +++ botlib/l_precomp.c (working copy) @@ -132,6 +132,7 @@ va_start(ap, str); Q_vsnprintf(text, sizeof(text), str, ap); + ZLASTCHAR(text); va_end(ap); #ifdef BOTLIB botimport.Print(PRT_ERROR, "file %s, line %d: %s\n", source->scriptstack->filename, source->scriptstack->line, text); @@ -157,6 +158,7 @@ va_start(ap, str); Q_vsnprintf(text, sizeof(text), str, ap); va_end(ap); + ZLASTCHAR(text); #ifdef BOTLIB botimport.Print(PRT_WARNING, "file %s, line %d: %s\n", source->scriptstack->filename, source->scriptstack->line, text); #endif //BOTLIB Index: botlib/l_script.c =================================================================== --- botlib/l_script.c (revision 1897) +++ botlib/l_script.c (working copy) @@ -238,6 +238,7 @@ va_start(ap, str); Q_vsnprintf(text, sizeof(text), str, ap); va_end(ap); + ZLASTCHAR(text); #ifdef BOTLIB botimport.Print(PRT_ERROR, "file %s, line %d: %s\n", script->filename, script->line, text); #endif //BOTLIB @@ -264,6 +265,7 @@ va_start(ap, str); Q_vsnprintf(text, sizeof(text), str, ap); va_end(ap); + ZLASTCHAR(text); #ifdef BOTLIB botimport.Print(PRT_WARNING, "file %s, line %d: %s\n", script->filename, script->line, text); #endif //BOTLIB Index: client/cl_main.c =================================================================== --- client/cl_main.c (revision 1897) +++ client/cl_main.c (working copy) @@ -2781,6 +2781,7 @@ va_start (argptr,fmt); Q_vsnprintf (msg, sizeof(msg), fmt, argptr); va_end (argptr); + ZLASTCHAR(msg); if ( print_level == PRINT_ALL ) { Com_Printf ("%s", msg); Index: qcommon/common.c =================================================================== --- qcommon/common.c (revision 1897) +++ qcommon/common.c (working copy) @@ -151,6 +151,7 @@ va_start (argptr,fmt); Q_vsnprintf (msg, sizeof(msg), fmt, argptr); va_end (argptr); + ZLASTCHAR(msg); if ( rd_buffer ) { if ((strlen (msg) + strlen(rd_buffer)) > (rd_buffersize - 1)) { @@ -230,6 +231,7 @@ va_start (argptr,fmt); Q_vsnprintf (msg, sizeof(msg), fmt, argptr); va_end (argptr); + ZLASTCHAR(msg); Com_Printf ("%s", msg); } @@ -284,6 +286,7 @@ va_start (argptr,fmt); Q_vsnprintf (com_errorMessage, sizeof(com_errorMessage),fmt,argptr); va_end (argptr); + ZLASTCHAR(com_errorMessage); if (code != ERR_DISCONNECT && code != ERR_NEED_CD) Cvar_Set("com_errorMessage", com_errorMessage); Index: qcommon/files.c =================================================================== --- qcommon/files.c (revision 1897) +++ qcommon/files.c (working copy) @@ -1319,6 +1319,7 @@ va_start (argptr,fmt); Q_vsnprintf (msg, sizeof(msg), fmt, argptr); va_end (argptr); + ZLASTCHAR(msg); FS_Write(msg, strlen(msg), h); } Index: qcommon/net_chan.c =================================================================== --- qcommon/net_chan.c (revision 1897) +++ qcommon/net_chan.c (working copy) @@ -634,6 +634,7 @@ va_start( argptr, format ); Q_vsnprintf( string+4, sizeof(string)-4, format, argptr ); va_end( argptr ); + ZLASTCHAR(string); // send the datagram NET_SendPacket( sock, strlen( string ), string, adr ); Index: qcommon/q_shared.c =================================================================== --- qcommon/q_shared.c (revision 1897) +++ qcommon/q_shared.c (working copy) @@ -292,7 +292,8 @@ va_start (argptr, format); Q_vsnprintf (string, sizeof(string), format, argptr); va_end (argptr); - + ZLASTCHAR(string); + Com_Printf("ERROR: %s, line %d: %s\n", com_parsename, com_lines, string); } @@ -304,6 +305,7 @@ va_start (argptr, format); Q_vsnprintf (string, sizeof(string), format, argptr); va_end (argptr); + ZLASTCHAR(string); Com_Printf("WARNING: %s, line %d: %s\n", com_parsename, com_lines, string); } @@ -942,7 +944,8 @@ va_start (argptr,fmt); len = Q_vsnprintf (bigbuffer, sizeof(bigbuffer), fmt,argptr); va_end (argptr); - if ( len >= sizeof( bigbuffer ) ) { + + if ( len >= sizeof( bigbuffer ) || len < 0 ) { Com_Error( ERR_FATAL, "Com_sprintf: overflowed bigbuffer" ); } if (len >= size) { @@ -977,6 +980,7 @@ va_start (argptr, format); Q_vsnprintf (buf, sizeof(*string), format, argptr); va_end (argptr); + ZLASTCHAR(buf); return buf; } Index: qcommon/q_shared.h =================================================================== --- qcommon/q_shared.h (revision 1897) +++ qcommon/q_shared.h (working copy) @@ -142,6 +142,8 @@ #define Q_snprintf snprintf #endif +#define ZLASTCHAR(s) (s)[sizeof(s)-1]='\0' + #ifdef _MSC_VER #include Index: server/sv_bot.c =================================================================== --- server/sv_bot.c (revision 1897) +++ server/sv_bot.c (working copy) @@ -141,6 +141,7 @@ va_start(ap, fmt); Q_vsnprintf(str, sizeof(str), fmt, ap); va_end(ap); + ZLASTCHAR(str); switch(type) { case PRT_MESSAGE: { Index: server/sv_main.c =================================================================== --- server/sv_main.c (revision 1897) +++ server/sv_main.c (working copy) @@ -189,6 +189,7 @@ va_start (argptr,fmt); Q_vsnprintf ((char *)message, sizeof(message), fmt,argptr); va_end (argptr); + ZLASTCHAR(message); // Fix to http://aluigi.altervista.org/adv/q3msgboom-adv.txt // The actual cause of the bug is probably further downstream Index: sys/sys_main.c =================================================================== --- sys/sys_main.c (revision 1897) +++ sys/sys_main.c (working copy) @@ -348,6 +348,7 @@ va_start (argptr,error); Q_vsnprintf (string, sizeof(string), error, argptr); va_end (argptr); + ZLASTCHAR(string); CL_Shutdown( string ); Sys_ErrorDialog( string ); @@ -368,6 +369,7 @@ va_start (argptr,warning); Q_vsnprintf (string, sizeof(string), warning, argptr); va_end (argptr); + ZLASTCHAR(string); CON_Print( va( "Warning: %s", string ) ); } @@ -426,6 +428,7 @@ assert( name ); Q_snprintf (fname, sizeof(fname), "%s" ARCH_STRING DLL_EXT, name); + ZLASTCHAR(fname); netpath = FS_FindDll(fname);