X-Git-Url: https://git.tcpdump.org/libpcap/blobdiff_plain/630b3a19cac0efcdc9fb06a773be02efc8c13980..HEAD:/pcap-netmap.c diff --git a/pcap-netmap.c b/pcap-netmap.c index 6f334f83..56a6bc41 100644 --- a/pcap-netmap.c +++ b/pcap-netmap.c @@ -33,6 +33,7 @@ #include #include #include +#include #define NETMAP_WITH_LIBS #include @@ -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: /*