From eaa606a83cf0708f5a7204dfe5f6f907b0a983b3 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sun, 31 Dec 2023 21:16:29 +0100 Subject: Replaced strcat() calls --- FICS/playerdb.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/FICS/playerdb.c b/FICS/playerdb.c index 5881c02..dbc36a8 100644 --- a/FICS/playerdb.c +++ b/FICS/playerdb.c @@ -44,6 +44,10 @@ #include "talkproc.h" #include "utils.h" +#if __linux__ +#include +#endif + PUBLIC player parray[PARRAY_SIZE]; PUBLIC int p_num = 0; @@ -1490,7 +1494,10 @@ player_pend_print(int p, pending *pend) sprintf(tmp, "%s ", parray[pend->whoto].name); } - strcat(outstr, tmp); + if (strlcat(outstr, tmp, sizeof outstr) >= sizeof outstr) { + fprintf(stderr, "FICS: %s: warning: strlcat() truncated\n", + __func__); + } switch (pend->type) { case PEND_MATCH: @@ -1529,7 +1536,11 @@ player_pend_print(int p, pending *pend) break; } - strcat(outstr, tmp); + if (strlcat(outstr, tmp, sizeof outstr) >= sizeof outstr) { + fprintf(stderr, "FICS: %s: warning: strlcat() truncated\n", + __func__); + } + pprintf(p, "%s\n", outstr); } -- cgit v1.2.3