aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-01-03 23:35:09 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-01-03 23:35:09 +0100
commit923bd0f710d68a1273321455d5036cd867ae43cf (patch)
treeb6bd82581e23cd1ac6c26d9b9d427919f87fd684
parentc1c3fc9220831fafd805cd9f7aa7ec65d08a8e4a (diff)
Replaced unbounded calls
-rw-r--r--FICS/comproc.c12
1 files 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 <bsd/string.h>
+#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);
}