aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-04-04 03:49:21 +0200
committerMarkus Uhlin <markus@nifty-networks.net>2024-04-04 03:49:21 +0200
commit0247a14cff6ac6e8b32ec0623954d4dc9f223dbb (patch)
tree13fe858627211ca6b5f89976e57cb13a7aa867fd
parenta69f395bfea7d83f425557a672be8003b5fb7914 (diff)
Replaced sprintf() calls with snprintf()
-rw-r--r--FICS/ratings.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/FICS/ratings.c b/FICS/ratings.c
index 3d2fb08..e08bc71 100644
--- a/FICS/ratings.c
+++ b/FICS/ratings.c
@@ -329,7 +329,8 @@ save_ratings(void)
FILE *fp;
char fname[MAX_FILENAME_SIZE] = { '\0' };
- sprintf(fname, "%s/newratingsV%d_data", stats_dir, STATS_VERSION);
+ snprintf(fname, sizeof fname, "%s/newratingsV%d_data", stats_dir,
+ STATS_VERSION);
if ((fp = fopen(fname, "w")) == NULL) {
fprintf(stderr, "FICS: Can't write ratings data!\n");
@@ -405,7 +406,7 @@ rating_recalc(void)
zero_stats();
for (c = 'a'; c <= 'z'; c++) {
- sprintf(dname, "%s/%c", player_dir, c);
+ snprintf(dname, sizeof dname, "%s/%c", player_dir, c);
if ((dirp = opendir(dname)) == NULL)
continue;
@@ -1177,7 +1178,7 @@ UpdateRank(int type, char *addName, statistics *sNew, char *delName)
return;
}
- sprintf(TmpRankFile, "%s/tmpRank", sdir);
+ snprintf(TmpRankFile, sizeof TmpRankFile, "%s/tmpRank", sdir);
if ((fptemp = fopen(TmpRankFile, "w")) == NULL) {
fprintf(stderr, "Unable to open rank file for updating.\n");
@@ -1211,7 +1212,7 @@ UpdateRank(int type, char *addName, statistics *sNew, char *delName)
fclose(fp);
// XXX
- sprintf(command, "mv %s %s", TmpRankFile, RankFile);
+ snprintf(command, sizeof command, "mv %s %s", TmpRankFile, RankFile);
system(command);
}
#endif