diff options
author | Simon Howard | 2014-03-30 19:08:27 -0400 |
---|---|---|
committer | Simon Howard | 2014-03-30 19:08:27 -0400 |
commit | 2ea8fd11ec5da77ba66b24c0c2cbee892e803904 (patch) | |
tree | eed48a3b6ce007c54671099c33a041a081609681 /src/strife/m_saves.c | |
parent | 01ae851bf998330a9ca95467e238c507aa55cae1 (diff) | |
download | chocolate-doom-2ea8fd11ec5da77ba66b24c0c2cbee892e803904.tar.gz chocolate-doom-2ea8fd11ec5da77ba66b24c0c2cbee892e803904.tar.bz2 chocolate-doom-2ea8fd11ec5da77ba66b24c0c2cbee892e803904.zip |
strife: Eliminate use of sprintf().
Use snprintf() in place of sprintf(). This is part of fixing #371.
Diffstat (limited to 'src/strife/m_saves.c')
-rw-r--r-- | src/strife/m_saves.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/strife/m_saves.c b/src/strife/m_saves.c index 2908b694..4303dbe2 100644 --- a/src/strife/m_saves.c +++ b/src/strife/m_saves.c @@ -222,8 +222,7 @@ void M_SaveMoveMapToHere(void) char tmpnum[33];
// haleyjd: no itoa available...
- memset(tmpnum, 0, sizeof(tmpnum));
- sprintf(tmpnum, "%d", gamemap);
+ snprintf(tmpnum, sizeof(tmpnum), "%d", gamemap);
// haleyjd: use M_SafeFilePath, not sprintf
mapsave = M_SafeFilePath(savepath, tmpnum);
@@ -252,8 +251,7 @@ void M_SaveMoveHereToMap(void) char tmpnum[33];
// haleyjd: no itoa available...
- memset(tmpnum, 0, sizeof(tmpnum));
- sprintf(tmpnum, "%d", gamemap);
+ snprintf(tmpnum, sizeof(tmpnum), "%d", gamemap);
mapsave = M_SafeFilePath(savepathtemp, tmpnum);
heresave = M_SafeFilePath(savepathtemp, "here");
@@ -479,8 +477,8 @@ char *M_MakeStrifeSaveDir(int slotnum, const char *extra) {
static char tmpbuffer[32];
- memset(tmpbuffer, 0, sizeof(tmpbuffer));
- sprintf(tmpbuffer, "strfsav%d.ssg%s", slotnum, extra);
+ snprintf(tmpbuffer, sizeof(tmpbuffer),
+ "strfsav%d.ssg%s", slotnum, extra);
return tmpbuffer;
}
|