From 923bd0f710d68a1273321455d5036cd867ae43cf Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Wed, 3 Jan 2024 23:35:09 +0100 Subject: Replaced unbounded calls --- FICS/comproc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/FICS/comproc.c b/FICS/comproc.c index 80ff236..925ddc8 100644 --- a/FICS/comproc.c +++ b/FICS/comproc.c @@ -58,6 +58,10 @@ #include "utils.h" #include "variable.h" +#if __linux__ +#include +#endif + #define WHO_OPEN 0x01 #define WHO_CLOSED 0x02 #define WHO_RATED 0x04 @@ -314,15 +318,15 @@ com_stats_andify(int *numbers, int howmany, char *dest) *dest = '\0'; while (howmany--) { - sprintf(tmp, "%d", numbers[howmany]); + snprintf(tmp, sizeof tmp, "%d", numbers[howmany]); strcat(dest, tmp); if (howmany > 1) - sprintf(tmp, ", "); + strlcpy(tmp, ", ", sizeof tmp); else if (howmany == 1) - sprintf(tmp, " and "); + strlcpy(tmp, " and ", sizeof tmp); else - sprintf(tmp, ".\n"); + strlcpy(tmp, ".\n", sizeof tmp); strcat(dest, tmp); } -- cgit v1.2.3