aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-03-23 13:56:59 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-03-23 13:56:59 +0100
commit57642387b4605582b95bfcfc7481f8c89e056daf (patch)
treed1abe6178bea1bd5d06999b9749ddb7a824eda5c /FICS
parent1a3fa38ff628282f2f2a95bb4695c9d732d06a05 (diff)
strlcat() plus truncation checks
Diffstat (limited to 'FICS')
-rw-r--r--FICS/comproc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/FICS/comproc.c b/FICS/comproc.c
index 8e4711f..1009c46 100644
--- a/FICS/comproc.c
+++ b/FICS/comproc.c
@@ -350,13 +350,16 @@ com_stats_rating(char *hdr, statistics *stats, char *dest, const size_t dsize)
if (stats->whenbest) {
snprintf(tmp, sizeof tmp, " %d", stats->best);
- strcat(dest, tmp);
+ strlcat(dest, tmp, dsize);
strftime(tmp, sizeof tmp, " (%d-%b-%y)",
localtime((time_t *) &stats->whenbest));
- strcat(dest, tmp);
+ strlcat(dest, tmp, dsize);
}
- strcat(dest, "\n");
+ if (strlcat(dest, "\n", dsize) >= dsize) {
+ (void) fprintf(stderr, "FICS: %s (line %d): warning: strlcat() "
+ "truncated\n", __func__, __LINE__);
+ }
}
PUBLIC int