--- src/fetch.c.orig
+++ src/fetch.c
@@ -1,4 +1,4 @@
-#define _POSIX_C_SOURCE 200809L
+#define _BSD_C_SOURCE
 
 #include <pthread.h>
 #include <stdbool.h>
@@ -8,6 +8,8 @@
 #include <sys/utsname.h>
 #include <time.h>
 
+#include <unistd.h>
+
 #include "colour.h"
 #include "config.h"
 
@@ -152,7 +154,8 @@
 		}
 		if (osname == NULL)
 			osname = malloc(512);
-		strcpy(osname, newContents);
+		size_t osname_size = sizeof(osname);
+		strlcpy(osname, newContents, osname_size);
 		free(newContents);
 		/* end */
 		if (strncmp(osname, "Alpine Linux", 12) == 0) {
@@ -438,10 +441,11 @@
 		    "dpkg -l | tail -n+6 | wc -l";
 
 			char *iosVer = malloc(1024);
-			strcpy(iosVer, "iOS ");
+			size_t iosVer_size = sizeof(iosVer);
+			strlcpy(iosVer, "iOS ", iosVer_size);
 			char *productVer = pipeRead("sw_vers -productVersion");
 
-			strcat(iosVer, productVer);
+			strlcat(iosVer, productVer, iosVer_size);
 			free(productVer);
 			osname = iosVer;
 			free(iosVer);
@@ -450,10 +454,11 @@
 			    "ls /usr/local/Cellar/* | grep ':' | wc -l | xargs";
 
 			char *macVer = malloc(64);
-			strcpy(macVer, "macOS ");
+			size_t macVer_size = sizeof(macVer);
+			strlcpy(macVer, "macOS ", macVer_size);
 			char *productVer = pipeRead("sw_vers -productVersion");
 
-			strcat(macVer, productVer);
+			strlcat(macVer, productVer, macVer_size);
 			free(productVer);
 			osname = macVer;
 			free(macVer);
