aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2023-12-17 12:25:06 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2023-12-17 12:25:06 +0100
commit04b25413336439e3e000833a134fd0f1db322763 (patch)
tree91dd43b1ffa219d9edba7ec9b8cd3bd87e977fe5
parent4e86e20febde75db0f3bda43d2b9da6b0cd8e1ba (diff)
Fixed compiler warning
-rw-r--r--FICS/comproc.c8
1 files changed, 7 insertions, 1 deletions
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);