sprintf audit.

This commit is contained in:
Bill Currie 2000-12-05 16:51:01 +00:00
parent b34504057c
commit 29970187d7
7 changed files with 8 additions and 7 deletions

View file

@ -640,7 +640,8 @@ void Con_DrawConsole (int lines)
dlbar[i++] = '\x82';
dlbar[i] = 0;
sprintf(dlbar + strlen(dlbar), " %02d%%", cls.downloadpercent);
snprintf(dlbar + strlen(dlbar), sizeof (dlbar) - strlen (dlbar),
" %02d%%", cls.downloadpercent);
// draw it
y = con_vislines-22 + 8;

View file

@ -473,7 +473,7 @@ void SCR_DrawFPS (void)
fps_count = 0;
lastframetime = t;
}
/* Misty: I really do need to read about sprintf a bit. This thing keeps chewing on my foot! */
/* Misty: I really do need to read about snprintf a bit. This thing keeps chewing on my foot! */
snprintf(st, sizeof(st), "%-3d FPS", lastfps);
/* Misty: New trick! (for me) the ? makes this work like a if then else - IE: if
cl_hudswap->int_val is not null, do first case, else (else is a : here) do second case.

View file

@ -699,7 +699,7 @@ void Mod_LoadLeafs (lump_t *l)
loadmodel->leafs = out;
loadmodel->numleafs = count;
//sprintf(s, "maps/%s.bsp", Info_ValueForKey(cl.serverinfo,"map"));
//snprintf(s, sizeof (s), "maps/%s.bsp", Info_ValueForKey(cl.serverinfo,"map"));
if (!strncmp("maps/", loadmodel->name,5))
isnotmap = false;
for ( i=0 ; i<count ; i++, in++, out++)

View file

@ -242,7 +242,7 @@ Qprintf(QFile *file, const char *fmt, ...)
(void)vsprintf(buf, fmt, args);
#endif
va_end(args);
ret = strlen(buf); /* some *sprintf don't return the nb of bytes written */
ret = strlen(buf); /* some *snprintf don't return the nb of bytes written */
if (ret>0)
ret=gzwrite(file, buf, (unsigned)ret);
}

View file

@ -110,7 +110,7 @@ void R_ReadPointFile_f (void)
particle_t *p;
char name[MAX_OSPATH];
// FIXME sprintf (name,"maps/%s.pts", sv.name);
// FIXME snprintf (name, sizeof (name), "maps/%s.pts", sv.name);
COM_FOpenFile (name, &f);
if (!f)

View file

@ -506,7 +506,7 @@ void SCR_DrawFPS (void)
fps_count = 0;
lastframetime = t;
}
/* Misty: I really do need to read about sprintf a bit. This thing keeps chewing on my foot! */
/* Misty: I really do need to read about snprintf a bit. This thing keeps chewing on my foot! */
snprintf (st, sizeof(st), "%-3d FPS", lastfps);
/* Misty: New trick! (for me) the ? makes this work like a if then else - IE: if
cl_hudswap->int_val is not null, do first case, else (else is a : here) do second case.

View file

@ -544,7 +544,7 @@ SVC_Log (void)
Con_DPrintf ("sending log %i to %s\n", svs.logsequence - 1,
NET_AdrToString (net_from));
// sprintf (data, "stdlog %i\n", svs.logsequence-1);
// snprintf (data, sizeof (data), "stdlog %i\n", svs.logsequence-1);
// strncat (data, (char *)svs.log_buf[((svs.logsequence-1)&1)], sizeof(data) - strlen (data));
snprintf (data, sizeof (data), "stdlog %i\n%s",
svs.logsequence - 1,