]> jfr.im git - irc/hexchat/hexchat.git/commitdiff
Fix new stringop-truncation warnings
authorPatrick Griffis <redacted>
Sat, 1 Sep 2018 20:32:37 +0000 (16:32 -0400)
committerPatrick Griffis <redacted>
Sat, 21 Dec 2019 06:25:50 +0000 (22:25 -0800)
plugins/sysinfo/unix/pci.c
src/common/dcc.c
src/common/server.c

index 10addf6fbb97aabb7da1fa97935b0c41410e8dc2..528afd97ac735e8838004b1af728cd67e0a0c340 100644 (file)
@@ -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");
index e26a291643314c9824461680ec30d5db27927c66..51f6d661bacafe2634e11a84214437603cf00dc6 100644 (file)
@@ -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;
index f2c5f91daeef8037e089845fe8158799d3b4fc04..3db0a9635fc5a1d1b6099290561cd439b8c0f8ad 100644 (file)
@@ -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;