]> 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 f17f36ca20c6f2aae9a2ae87a9eec0bbb53b09f9..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:
                /*
@@ -235,7 +240,7 @@ pcap_netmap_activate(pcap_t *p)
        }
 #if 0
        fprintf(stderr, "%s device %s priv %p fd %d ports %d..%d\n",
-           __FUNCTION__, p->opt.device, d, d->fd,
+           __func__, p->opt.device, d, d->fd,
            d->first_rx_ring, d->last_rx_ring);
 #endif
        pn->d = d;