]> The Tcpdump Group git mirrors - libpcap/commitdiff
Fix valgrind warning (jump on unitialized value) due to missing ioctl wrapper
authorDavid Clark <[email protected]>
Wed, 20 Mar 2013 00:06:35 +0000 (17:06 -0700)
committerMichael Richardson <[email protected]>
Sun, 14 Apr 2013 22:33:07 +0000 (18:33 -0400)
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.

pcap-linux.c

index 6a4d8aad7629dcfe83ebc8d7cb6548eca86003f8..201f2aade2baa6d1cb3a1875d5899e6039972563 100644 (file)
@@ -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) {