summaryrefslogtreecommitdiff
path: root/src/common/lock.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/lock.c')
-rw-r--r--src/common/lock.c6
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