diff options
author | Paradox924X <Paradox924X@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2010-12-07 18:38:03 +0000 |
---|---|---|
committer | Paradox924X <Paradox924X@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2010-12-07 18:38:03 +0000 |
commit | 663c9c7ce25d3df3749c55c28af162c46015bc92 (patch) | |
tree | 29acf07133e1b5b1bc055481c5667b4133e740cf /src/common/lock.c | |
parent | 53daf01b4b07ce131c79fc784220ba6826e70d16 (diff) | |
download | hercules-663c9c7ce25d3df3749c55c28af162c46015bc92.tar.gz hercules-663c9c7ce25d3df3749c55c28af162c46015bc92.tar.bz2 hercules-663c9c7ce25d3df3749c55c28af162c46015bc92.tar.xz hercules-663c9c7ce25d3df3749c55c28af162c46015bc92.zip |
Changed almost all instances of sprintf() to snprintf().
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14563 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common/lock.c')
-rw-r--r-- | src/common/lock.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/common/lock.c b/src/common/lock.c index 643b86e5c..a4bcc7fe0 100644 --- a/src/common/lock.c +++ b/src/common/lock.c @@ -25,7 +25,7 @@ FILE* lock_fopen (const char* filename, int *info) { // 安全なファイル名を得る(手抜き) do { - sprintf(newfile, "%s_%04d.tmp", filename, ++no); + snprintf(newfile, sizeof newfile, "%s_%04d.tmp", filename, ++no); } while(exists(newfile) && no < 9999); *info = no; return fopen(newfile,"w"); @@ -38,8 +38,8 @@ int lock_fclose (FILE *fp, const char* filename, int *info) { char oldfile[512]; if (fp != NULL) { ret = fclose(fp); - sprintf(newfile, "%s_%04d.tmp", filename, *info); - sprintf(oldfile, "%s.bak", filename); // old backup file + snprintf(newfile, sizeof newfile, "%s_%04d.tmp", filename, *info); + snprintf(oldfile, sizeof oldfile, "%s.bak", filename); // old backup file if (exists(oldfile)) remove(oldfile); // remove backup file if it already exists rename (filename, oldfile); // backup our older data instead of deleting it |