From 1a3fa38ff628282f2f2a95bb4695c9d732d06a05 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sat, 23 Mar 2024 13:48:46 +0100 Subject: Added param 'dsize' to com_stats_rating() --- FICS/comproc.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'FICS/comproc.c') 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); } -- cgit v1.2.3