Nmap Development mailing list archives

Re: [Pcap] Fixed Valgrind error message.


From: David Fifield <david () bamsoftware com>
Date: Wed, 22 Sep 2010 07:20:48 -0700

On Wed, Sep 22, 2010 at 11:46:23AM +0200, Luis MartinGarcia. wrote:
Hi,

I've been tracking down an error in libpcap reported by Valgrind. The
error 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 just commited a patch that adds a simple memset() that initializes
a structure to zero. This makes the problem go away.

I've sent a report to the tcpdump-workers lists requesting the patch to
be applied to mainstream. However, as the patch is so small and simple,
I'm applying it to our own version now. I hope this is OK.

Thank you for sending it upstream. I suspect this is not a real bug;
that the setsockopt call is expecting the kernel to initialize &fcode,
so it's not necessary to initialize it in advance. We'll see what
tcpdump-workers say.

David Fifield
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: