Nmap Development mailing list archives

assumptions about new


From: "David Byron" <DByron () everdreamcorp com>
Date: Wed, 17 Nov 2004 19:58:31 -0800

I'm trying to track down an nmap 3.75 issue on some Windows machines
where the OS is complaining about an access of memory location 0.  While
looking through the code, I see a few places where new is called and the
return value dereferenced without checking for NULL.  Some C++ libraries
throw an exception when new can't return memory.  I'm pretty sure nmap
is set up to build on Windows without that.  Does the nmap code in
general assume that this is what happens?  I tried to find a catch
block, but haven't had any luck.

For example, in nmap.cc(1.55) on line 963, hstate could be NULL.  It's
passed to nexthost, and the first line of nexthost() in targets.cc
dereferences without checking for NULL.

I have a feeling I'll find more of these.  I'll submit a patch with some
checking and my best guess how to handle them unless there's a
preference for a try/catch block somewhere near main to handle this.

Thanks much for nmap.

-DB

---------------------------------------------------------------------
For help using this (nmap-dev) mailing list, send a blank email to
nmap-dev-help () insecure org . List archive: http://seclists.org



Current thread: