aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-01-03 22:43:34 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-01-03 22:43:34 +0100
commitc887a8a9fd5ed8058398ff57e643da821e6e2e09 (patch)
treedc93922e4fb50e91bff685c004aafabb2ac7fd6d
parentc3c80d017e0d27a1659458419afedf44882832b0 (diff)
Reformatted functions and replaced sprintf() calls with snprintf()
-rw-r--r--FICS/comproc.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/FICS/comproc.c b/FICS/comproc.c
index 7f2a992..20385c3 100644
--- a/FICS/comproc.c
+++ b/FICS/comproc.c
@@ -684,24 +684,30 @@ plogins(int p, char *fname)
return COM_OK;
}
-PUBLIC int com_llogons(int p, param_list param)
+PUBLIC int
+com_llogons(int p, param_list param)
{
- char fname[MAX_FILENAME_SIZE];
+ char fname[MAX_FILENAME_SIZE] = { '\0' };
- sprintf(fname, "%s/%s", stats_dir, STATS_LOGONS);
- return plogins(p, fname);
+ snprintf(fname, sizeof fname, "%s/%s", stats_dir, STATS_LOGONS);
+ return plogins(p, fname);
}
-PUBLIC int com_logons(int p, param_list param)
+PUBLIC int
+com_logons(int p, param_list param)
{
- char fname[MAX_FILENAME_SIZE];
+ char fname[MAX_FILENAME_SIZE] = { '\0' };
- if (param[0].type == TYPE_WORD) {
- sprintf(fname, "%s/player_data/%c/%s.%s", stats_dir, param[0].val.word[0], param[0].val.word, STATS_LOGONS);
- } else {
- sprintf(fname, "%s/player_data/%c/%s.%s", stats_dir, parray[p].login[0], parray[p].login, STATS_LOGONS);
- }
- return plogins(p, fname);
+ if (param[0].type == TYPE_WORD) {
+ snprintf(fname, sizeof fname, "%s/player_data/%c/%s.%s",
+ stats_dir, param[0].val.word[0], param[0].val.word,
+ STATS_LOGONS);
+ } else {
+ snprintf(fname, sizeof fname, "%s/player_data/%c/%s.%s",
+ stats_dir, parray[p].login[0], parray[p].login,
+ STATS_LOGONS);
+ }
+ return plogins(p, fname);
}
PRIVATE void