aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/shutdown.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-03-17 15:50:45 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-03-17 15:50:45 +0100
commita876a40a0978fea2f3c832413282d9c2b3dfe149 (patch)
tree34ec6228b8e38011b3d482bec3c511c0846b4992 /FICS/shutdown.c
parent1ce66140f254f6688db6cffc20eec509b3793a96 (diff)
Added usage of strlcpy()
Diffstat (limited to 'FICS/shutdown.c')
-rw-r--r--FICS/shutdown.c10
1 files 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 <bsd/string.h>
+#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);