diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-03-23 13:48:46 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-03-23 13:48:46 +0100 |
commit | 1a3fa38ff628282f2f2a95bb4695c9d732d06a05 (patch) | |
tree | cbea9554505a6188a116c6a7bbdf6461d630ea97 | |
parent | 18e289b2c957fa1f915b809e313c16a48a4ea8e3 (diff) |
Added param 'dsize' to com_stats_rating()
-rw-r--r-- | FICS/comproc.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/FICS/comproc.c b/FICS/comproc.c index 1b1e179..8e4711f 100644 --- a/FICS/comproc.c +++ b/FICS/comproc.c @@ -336,11 +336,11 @@ com_stats_andify(int *numbers, int howmany, char *dest, size_t dsize) } PRIVATE void -com_stats_rating(char *hdr, statistics *stats, char *dest) +com_stats_rating(char *hdr, statistics *stats, char *dest, const size_t dsize) { char tmp[100] = { '\0' }; - sprintf(dest, "%-10s%4s %5.1f %4d %4d %4d %4d", hdr, + snprintf(dest, dsize, "%-10s%4s %5.1f %4d %4d %4d %4d", hdr, ratstr(stats->rating), stats->sterr, stats->win, @@ -464,13 +464,15 @@ com_stats(int p, param_list param) pprintf(p, "\n rating RD win loss draw " "total best\n"); - com_stats_rating("Blitz", &parray[p1].b_stats, tmp); + com_stats_rating("Blitz", &parray[p1].b_stats, tmp, sizeof tmp); pprintf(p, "%s", tmp); - com_stats_rating("Standard", &parray[p1].s_stats, tmp); + com_stats_rating("Standard", &parray[p1].s_stats, tmp, + sizeof tmp); pprintf(p, "%s", tmp); - com_stats_rating("Lightning", &parray[p1].l_stats, tmp); + com_stats_rating("Lightning", &parray[p1].l_stats, tmp, + sizeof tmp); pprintf(p, "%s", tmp); - com_stats_rating("Wild", &parray[p1].w_stats, tmp); + com_stats_rating("Wild", &parray[p1].w_stats, tmp, sizeof tmp); pprintf(p, "%s", tmp); } |