tcpdump mailing list archives

Re: SEGFAULT in pcap_findalldevs on OpenBSD 3.4


From: "Mark Pizzolato" <List-tcpdump-workers () subscriptions pizzolato net>
Date: Fri, 12 Mar 2004 01:18:04 -0800

On Mar 11, 2004, at 3:57 PM, Guy Harris wrote:
On Mar 11, 2004, at 1:37 PM, Mark Pizzolato wrote:

pcap_findalldevs dies on OpenBSD 3.4 while interpreting some of the 
data
returned by getifaddrs.  Specifically, the flag value suggests that a
Broadcast address is provided, but none is really returned.

This problem does not exist on FreeBSD or NetBSD.

Does OpenBSD 3.4 have an "SA_LEN()" macro that doesn't check whether 
its argument is null?

Yes it has a SA_LEN macro and it DOES NOT check for a null argument.

If so, do the versions of FreeBSD and NetBSD at which you're looking 
lack that macro?

NetBSD 1.5.1 doesn't seem to have a SA_LEN macro.
FreeBSD 4.9 doesn't seem to have a SA_LEN macro either.

If so, the problem is that "pcap_findalldevs()" is relying on 
"SA_LEN()" to do the checking for a null pointer - which works fine if 
"SA_LEN()" is the one defined in "fad-getad.c", but not so fine if it's 
supplied by the OS and doesn't do that checking.

It seems that you've nailed it.

I've checked in a change to remove the checks from "SA_LEN()" and have 
the code that *uses* "SA_LEN()" check for the null pointers.  Try the 
current CVS version (either the main branch or the 0.8 branch - I've 
checked the changes into both places) and see if the problem is fixed.

The problem is fixed.

Thanks.

- Mark Pizzolato
-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:tcpdump-workers-request () tcpdump org?body=unsubscribe


Current thread: