]> The Tcpdump Group git mirrors - libpcap/blobdiff - pcap-netmap.c
CI: Call print_so_deps() on rpcapd in remote enabled build
[libpcap] / pcap-netmap.c
index 6f334f8307b789fe4632b51dc3034680192812d6..56a6bc418086d8aad8d70615ce146ed527d2395d 100644 (file)
@@ -33,6 +33,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <sys/ioctl.h>
 
 #define NETMAP_WITH_LIBS
 #include <net/netmap_user.h>
@@ -139,7 +140,11 @@ pcap_netmap_ioctl(pcap_t *p, u_long what, uint32_t *if_flags)
        }
 #endif /* __linux__ */
        bzero(&ifr, sizeof(ifr));
-       strncpy(ifr.ifr_name, d->req.nr_name, sizeof(ifr.ifr_name));
+       /*
+        * ifreq.ifr_name and nmreq.nr_name have the same size and both
+        * contain a NUL-terminated string.
+        */
+       (void)pcapint_strlcpy(ifr.ifr_name, d->req.nr_name, sizeof(ifr.ifr_name));
        switch (what) {
        case SIOCSIFFLAGS:
                /*