Nmap Development mailing list archives

Re: [PATCH] nsock_core.c unsigned int compilation error


From: Djalal Harouni <tixxdz () gmail com>
Date: Fri, 29 Oct 2010 12:22:57 +0100

On 2010-10-28 15:21:22 -0700, David Fifield wrote:
On Sun, Oct 24, 2010 at 11:15:56PM +0100, Rob Nicholls wrote:
I recently tried compiling Nmap from SVN and was surprised to see it was
failing on Windows! It seems that nsock_core.c was trying to pass an
unsigned integer value (peerlen) to recvfrom when it was expecting an
integer (according to Visual C++ 2008 SP1). As peerlen holds the rather
small value returned from "sizeof(peer)", I'm pretty sure (but I'm not that
hot on C) that it's fine to simply remove the word "unsigned", and this does
appear to allow Nmap to compile and run okay on Windows (only tested it
briefly). I hope I've fixed it correctly.

Thanks Rob. I think it might be unsigned on some operating systems
(BSD?) so I changed it to socklen_t which should hide the differences.
Yes in some operating systems it's an int and in others it's an unsigned,
you can find more info in the NOTES section of "man 2 accept".

Pls note that there is a check for this in libpcap included with Nmap,
file: libpcap/pcap-linux.c, line: 255.
  #ifndef HAVE_SOCKLEN_T
  typedef int socklen_t;
  #endif

It would be better to generate it in the nbase config file.

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


Current thread: