From 04b25413336439e3e000833a134fd0f1db322763 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sun, 17 Dec 2023 12:25:06 +0100 Subject: Fixed compiler warning --- FICS/comproc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'FICS/comproc.c') diff --git a/FICS/comproc.c b/FICS/comproc.c index 39beb11..5314d58 100644 --- a/FICS/comproc.c +++ b/FICS/comproc.c @@ -666,6 +666,7 @@ who_verbose(int p, int num, int plist[]) char playerLine[255]; char tmp[255]; int p1; + int ret, too_long; pprintf(p, " +---------------------------------------------------------------+\n"); pprintf(p, " | User Standard Blitz On for Idle |\n"); @@ -708,7 +709,12 @@ who_verbose(int p, int num, int plist[]) psprintf_highlight(p, tmp + strlen(tmp), "%-17s", p1WithAttrs); } else { - sprintf(tmp, " %-17s", p1WithAttrs); + ret = snprintf(tmp, sizeof tmp, " %-17s", p1WithAttrs); + too_long = (ret < 0 || (size_t)ret >= sizeof tmp); + if (too_long) { + fprintf(stderr, "FICS: %s: warning: " + "snprintf truncated\n", __func__); + } } strcat(playerLine, tmp); -- cgit v1.2.3