Nmap Development mailing list archives

Re: nmap-5.20 on x86_64 Segmentation fault


From: David Fifield <david () bamsoftware com>
Date: Wed, 27 Jan 2010 01:11:01 -0700

On Tue, Jan 26, 2010 at 11:41:05AM +0100, Gunnar Lindberg wrote:
INET6_ADDRSTRLEN in netinet/in.h.
#define INET6_ADDRSTRLEN 46

An observation:

There still is an implicit length compiled into the code, since

    sscanf(tp, "nameserver %65s", ipaddr)
    sscanf(tp, "nameserver %127s", nsrvr)

I think that's hard to get "%s46s" from that "#define".

To be strict you have to do more checks - or make it "big enough"

    char nsrvr[BUFSIZ];
    sscanf(tp, "nameserver %s", nsrvr)

Lazy me would probably go for that "big enough" :-).

I've committed a fix for this, using Kris's dynamic format string idea.
If you have IPv6 addresses in your /etc/resolv.conf but your operating
system doesn't support IPv6, you will still get the "Socket troubles"
error.

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: