nmap/libdnet-stripped/src
david 0674925f73 Skip over entire ifreq struct in NEXTIFR.
On platforms supporting sa_len, NEXTIFR would skip over sa_len bytes
starting at the beginning of ifr_addr, and assume that was the end of
the struct. (The idea being that a large address such as a sockaddr_in6
could overflow the nominal struct boundary.) This logic was wrong when
there was something else in the union bigger than sa_len; we would
increment into somewhere in the middle of the same struct.

This exhibited itself on NetBSD, where struct ifreq has a
sockaddr_storage member in its internal union:
struct	ifreq {
	char	ifr_name[IFNAMSIZ];		/* if name, e.g. "en0" */
	union {
		struct	sockaddr ifru_addr;
		struct	sockaddr ifru_dstaddr;
		struct	sockaddr ifru_broadaddr;
		struct	sockaddr_storage ifru_space;

No, we skip over sa_len bytes, or to the nominal end of the struct,
whichever is larger.

Unix Network Programming gets this wrong too; in figure 17.8 they do
ptr += sizeof(ifr->ifr_name) + max(sizeof(struct sockaddr), ifr->ifr_addr.sa_len);
2012-09-10 01:17:28 +00:00
..
addr-util.c Resolve strict-aliasing problems in ip6_ntop. 2012-09-01 03:29:39 +00:00
addr.c Handle ARPHRD_VOID in addr_ston. 2012-07-21 07:35:41 +00:00
arp-bsd.c
arp-ioctl.c
arp-none.c
arp-win32.c
blob.c
crc32ct.h
err.c
eth-bsd.c Open bpf devices in read/write mode, not read-only, in libdnet on BSD. This is 2009-11-09 04:49:32 +00:00
eth-dlpi.c Try /dev/net/<iface> after /dev/<iface> with DLPI. 2012-03-17 12:06:27 +00:00
eth-linux.c
eth-ndd.c
eth-none.c
eth-pfilt.c
eth-snoop.c
eth-win32.c Move the body of eth_get_pcap_devname back into intf_get_pcap_devname, leaving 2010-05-13 04:06:53 +00:00
fw-none.c
intf-win32.c Use a large initial buffer in the call to GetAdaptersAddresses. 2012-05-10 21:29:54 +00:00
intf.c Skip over entire ifreq struct in NEXTIFR. 2012-09-10 01:17:28 +00:00
ip-cooked.c
ip-util.c
ip-win32.c
ip.c Use socklen_t as the type in arguments to getsockname and getsockopt to 2009-08-07 00:11:57 +00:00
ip6.c
Makefile.am
Makefile.in autoreconf with Autoconf 2.63, Automake 1.10.1, and libtool 2.2.6. 2009-08-06 22:00:34 +00:00
memcmp.c
rand.c
route-bsd.c Substitute on-link routes' gateways with an all-zero address. 2012-03-26 22:24:55 +00:00
route-hpux.c
route-linux.c Merge from /nmap-exp/david/nmap-ipv6. 2011-06-08 01:24:48 +00:00
route-none.c
route-win32.c Remove unreferenced local variable. 2011-06-22 18:35:56 +00:00
strlcat.c
strlcpy.c
strsep.c
tun-bsd.c
tun-linux.c
tun-none.c
tun-solaris.c