From 7dc163eb6176320696d7d614fd2a4ad99e613b93 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 21 Sep 2000 16:23:51 +0000 Subject: [PATCH] sprintf -> snprintf --- source/console.c | 1 - source/gib.c | 2 +- source/gib_interpret.c | 6 +++--- source/gl_screen.c | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/source/console.c b/source/console.c index 53f4fd9..e5b9f9a 100644 --- a/source/console.c +++ b/source/console.c @@ -393,7 +393,6 @@ Handles cursor positioning, line wrapping, etc ================ */ #define MAXPRINTMSG 4096 -// FIXME: make a buffer size safe vsprintf? void Con_Printf (char *fmt, ...) { va_list argptr; diff --git a/source/gib.c b/source/gib.c index 3ff851a..7fdf301 100644 --- a/source/gib.c +++ b/source/gib.c @@ -57,7 +57,7 @@ void GIB_Load_f (void) char filename[256]; QFile *f; - sprintf(filename, "%s/%s.gib", com_gamedir, Cmd_Argv(1)); + snprintf(filename, sizeof(filename), "%s/%s.gib", com_gamedir, Cmd_Argv(1)); f = Qopen(filename, "r"); if (f) { diff --git a/source/gib_interpret.c b/source/gib_interpret.c index 6f21d6d..867318f 100644 --- a/source/gib_interpret.c +++ b/source/gib_interpret.c @@ -163,11 +163,11 @@ int GIB_Run_Sub (gib_module_t *mod, gib_sub_t *sub) for (i = 0; i <= gib_subargc; i++) { - sprintf(buf, "arg%i", i); + snprintf(buf, sizeof(buf), "arg%i", i); GIB_Var_Set (buf, gib_subargv[i]); } - sprintf(buf, "%i", gib_subargc); + snprintf(buf, sizeof(buf), "%i", gib_subargc); GIB_Var_Set ("argc", buf); ret = GIB_Execute_Sub (); @@ -195,4 +195,4 @@ int GIB_Run_Inst (char *inst) return ret; } return GIB_Execute_Inst (); -} \ No newline at end of file +} diff --git a/source/gl_screen.c b/source/gl_screen.c index 9c34045..8880518 100644 --- a/source/gl_screen.c +++ b/source/gl_screen.c @@ -509,7 +509,7 @@ void SCR_DrawFPS (void) lastframetime = t; } - sprintf(st, "%3d FPS", lastfps); + snprintf(st, sizeof(st), "%3d FPS", lastfps); x = vid.width - strlen(st) * 8 - 8; y = vid.height - sb_lines - 8; Draw_String8 (x, y, st);