Nmap Development mailing list archives

Re: nmap-5.20 on x86_64 Segmentation fault


From: Kris Katterjohn <katterjohn () gmail com>
Date: Tue, 26 Jan 2010 10:04:22 -0600

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/26/2010 04:41 AM, 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".


For a problem like this, one solution would be to build the format string with
sprintf(), setting the length of any fields, and passing this to sscanf().

Something like (untested):

sprintf(fmt, "nameserver %%%us", len); // whatever length you want
sscanf(tp, fmt, nsrvr);

Just a thought.

      Gunnar


Cheers,
Kris Katterjohn

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIcBAEBAgAGBQJLXxKFAAoJEEQxgFs5kUfuHf4P/Ajbd6kjatrdLK3pOlATvHOA
qMhZXt452qsU2/DzsWU0RlZtYzRtIl3nSUmBFnAKv0dVT3uOga5MAbnb50DGgpHO
7cOESzIJUeZP4GZXOuJUotY17RbmdqAQjKSlRy2l2JYIt/Ej0czSKI5pJynt0LfX
BJoNxoWvSJ6OcHRpsMqyVzAR1wDxtOif4bssBg/CkyX9NnVrvyD92nWRrY/8En/I
d/TJSFtoRz73GoWARqfH55IXr6JprqGmAJpSUbeiFFAxGx2ppVnwkrIPePzIhjmx
xAksR1tq9Paz9O+jhhDjR/+yXAaFTfpwDVWOIxt+oX8lU35TELjZy4fkkxyuzh9J
cRyCjjAnyNn/HgRJ4KtS8CixZTqCoxs517XfurJ3tIpjp5LwYcM8deKPSwhTKtaS
7XrmiQmY22nDixogAgTQohBWi1C2TF9A2Hsgd3EEouCND4bEFGWk1it+SwNCv8qx
zO59JKJgT9R2AygoLuljQVwAkQxmLhkbXzuYDVoaZ7oaRWpNpEadjAt4Qu4HVaXV
nB6lSlB98/Ps7IjCF0yKzufXPMznhRtBGoLcLh+IeZqVGbd9CoHdFIyJCKYustio
KH0kQA8f2y7c0PpNsk2dnWxGLw2m8Q5BJ+xS/EvOt52cBFW7qFAC4Fx+UucnDJON
af/f5CzkjQnSZNqpb2BX
=R0z/
-----END PGP SIGNATURE-----
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: