From: David Clark Date: Wed, 20 Mar 2013 00:06:35 +0000 (-0700) Subject: Fix valgrind warning (jump on unitialized value) due to missing ioctl wrapper X-Git-Tag: libpcap-1.5.0~61 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/76b1c8f6a8255759a24983a26960d61ab03af20c Fix valgrind warning (jump on unitialized value) due to missing ioctl wrapper Valgrind doesn't have a wrapper for the SIOCETHTOOL ioctl call yet. This is causing every program that uses libpcap and valgrind to produce some false warnings because it thinks eval.data was never initialized. A harmless fix is to just set eval.data to 0 instead of leaving it unitialized before the SIOCETHTOOL ioctl call sets it. --- diff --git a/pcap-linux.c b/pcap-linux.c index 6a4d8aad..201f2aad 100644 --- a/pcap-linux.c +++ b/pcap-linux.c @@ -4934,6 +4934,7 @@ iface_ethtool_ioctl(pcap_t *handle, int cmd, const char *cmdname) memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, handle->opt.source, sizeof(ifr.ifr_name)); eval.cmd = cmd; + eval.data = 0; ifr.ifr_data = (caddr_t)&eval; if (ioctl(handle->fd, SIOCETHTOOL, &ifr) == -1) { if (errno == EOPNOTSUPP || errno == EINVAL) {