tcpdump mailing list archives
[Pcap] setsockopt(optval) points to uninitialised byte(s)
From: "Luis MartinGarcia." <luis.mgarc () gmail com>
Date: Wed, 22 Sep 2010 11:37:11 +0200
Hi, I've been trying to track down a problem reported by valgrind. When using pcap_set_filter() on Linux, valgrind complains about a setsockopt() call that uses a pointer to some uninitialized memory. The message I get is the following: ==22214== Syscall param socketcall.setsockopt(optval) points to uninitialised byte(s) ==22214== at 0x62F774A: setsockopt (syscall-template.S:82) ==22214== by 0x4E33B85: ??? (in /usr/lib/libpcap.so.1.0.0) ==22214== by 0x4E33D0D: ??? (in /usr/lib/libpcap.so.1.0.0) ==22214== by 0x432253: nsock_pcap_set_filter (in /usr/local/bin/nping) ==22214== by 0x432557: nsock_pcap_open (in /usr/local/bin/nping) ==22214== by 0x4295FF: ProbeMode::start() (in /usr/local/bin/nping) ==22214== by 0x40B2E1: main (in /usr/local/bin/nping) (I've been able to reproduce this message in other tools that use pcap, so this isn't implementation specific). Also, I have tracked down the problem to pcap-linux.c::pcap_setfilter_linux_common(). By adding a simple memset() call, I am able to get rid of the message. I attach a patch that fixes this issue. Please, consider integrating it into mainstream. Regards, Luis MartinGarcia.
Attachment:
pcap_valgrind.diff
Description:
- This is the tcpdump-workers list. Visit https://cod.sandelman.ca/ to unsubscribe.
Current thread:
- bpf_filter() crashes on 64 bit machines with ip6 protochain Gregor Maier (Aug 30)
- <Possible follow-ups>
- bpf_filter() crashes on 64 bit machines with ip6 protochain Gregor Maier (Sep 21)
- [Pcap] setsockopt(optval) points to uninitialised byte(s) Luis MartinGarcia. (Sep 22)