summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPatrick Griffis <tingping@tingping.se>2018-09-01 16:32:37 -0400
committerPatrick Griffis <tingping@tingping.se>2018-09-01 16:35:48 -0400
commit18eae24acfedce4b5eab761edf23748642004ae3 (patch)
tree14bfe4ba677d993ff60c3df8aff6107201987a78
parentc092af89a24d05b1d02858f3d84c38292e2347b5 (diff)
Fix new stringop-truncation warnings
-rw-r--r--plugins/sysinfo/unix/pci.c4
-rw-r--r--src/common/dcc.c2
-rw-r--r--src/common/server.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/plugins/sysinfo/unix/pci.c b/plugins/sysinfo/unix/pci.c
index 10addf6f..528afd97 100644
--- a/plugins/sysinfo/unix/pci.c
+++ b/plugins/sysinfo/unix/pci.c
@@ -142,7 +142,7 @@ void pci_find_fullname(char *fullname, char *vendor, char *device)
 		{
 			position = strstr(buffer, vendor);
 			position += 6;
-			strncpy(vendorname, position, bsize/2);
+			g_strlcpy(vendorname, position, sizeof (vendorname));
 			position = strstr(vendorname, "\n");
 			*(position) = '\0';
 			break;
@@ -154,7 +154,7 @@ void pci_find_fullname(char *fullname, char *vendor, char *device)
 		{
 			position = strstr(buffer, device);
 			position += 6;
-			strncpy(devicename, position, bsize/2);
+			g_strlcpy(devicename, position, sizeof (devicename));
 			position = strstr(devicename, " (");
 			if (position == NULL)
 				position = strstr(devicename, "\n");
diff --git a/src/common/dcc.c b/src/common/dcc.c
index e26a2916..51f6d661 100644
--- a/src/common/dcc.c
+++ b/src/common/dcc.c
@@ -1006,7 +1006,7 @@ dcc_socks_proxy_traverse (GIOChannel *source, GIOCondition condition, struct DCC
 		sc.type = 1;
 		sc.port = htons (dcc->port);
 		sc.address = htonl (dcc->addr);
-		strncpy (sc.username, prefs.hex_irc_user_name, 9);
+		g_strlcpy (sc.username, prefs.hex_irc_user_name, sizeof (sc.username));
 		memcpy (proxy->buffer, &sc, sizeof (sc));
 		proxy->buffersize = 8 + strlen (sc.username) + 1;
 		proxy->bufferused = 0;
diff --git a/src/common/server.c b/src/common/server.c
index f2c5f91d..3db0a963 100644
--- a/src/common/server.c
+++ b/src/common/server.c
@@ -1042,7 +1042,7 @@ traverse_socks (int print_fd, int sok, char *serverAddr, int port)
 	sc.type = 1;
 	sc.port = htons (port);
 	sc.address = inet_addr (serverAddr);
-	strncpy (sc.username, prefs.hex_irc_user_name, 9);
+	g_strlcpy (sc.username, prefs.hex_irc_user_name, sizeof (sc.username));
 
 	send (sok, (char *) &sc, 8 + strlen (sc.username) + 1, 0);
 	buf[1] = 0;