From a876a40a0978fea2f3c832413282d9c2b3dfe149 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sun, 17 Mar 2024 15:50:45 +0100 Subject: Added usage of strlcpy() --- FICS/shutdown.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/FICS/shutdown.c b/FICS/shutdown.c index 861c9fe..89354d0 100644 --- a/FICS/shutdown.c +++ b/FICS/shutdown.c @@ -13,6 +13,10 @@ #include "shutdown.h" #include "utils.h" +#if __linux__ +#include +#endif + PRIVATE char downer[1024]; PRIVATE char reason[1024]; @@ -163,7 +167,7 @@ com_shutdown(int p, param_list param) int p1, secs; ASSERT(parray[p].adminLevel >= ADMIN_ADMIN); - strcpy(downer, parray[p].name); + strlcpy(downer, parray[p].name, sizeof downer); shutdownStartTime = time(0); if (shutdownTime) { // Cancel any pending shutdowns @@ -238,7 +242,7 @@ com_shutdown(int p, param_list param) if (shutdownTime <= 0) ShutDown(); if (param[1].type == TYPE_STRING) - strcpy(reason, param[1].val.string); + strlcpy(reason, param[1].val.string, sizeof reason); else reason[0] = '\0'; // No reason - perhaps admin is in a // bad mood? :) @@ -279,7 +283,7 @@ server_shutdown(int secs, char *why) return 0; } - strcpy(downer, "Automatic"); + strlcpy(downer, "Automatic", sizeof downer); shutdownTime = secs; shutdownStartTime = time(NULL); -- cgit v1.2.3