Nmap Development mailing list archives

Re: nmap 3.3+V-2.99


From: Brett Hutley <brett () hutley net>
Date: Mon, 01 Sep 2003 09:42:51 +1000

Gisle Vanem wrote:
*snip*
Here's some patches that works for me:

diff -u3 -H -B -r .\menes-ext\refcount.hpp ..\menes-ext\refcount.hpp
--- .\menes-ext\refcount.hpp    Sun Aug 31 07:05:09 2003
+++ ..\menes-ext\refcount.hpp   Sun Aug 31 18:45:41 2003
@@ -114,7 +114,8 @@
     typedef Counted_ Value;

     inline void Clear(Value &value) const {
-        value = NULL;
+        if (value)
+                       value = NULL;
     }

Not sure why, but Clear() is using a NULL-ptr somewhere.
*snip*

Doesn't this break the semantics of passing Value by reference? The function call implies that Value should be treated as the object rather than a pointer to the object. It would therefore be better to look at the callers of this function. I presume someone is doing something like this:

Value *value = new Value(); // This call is failing for whatever reason
// value is now NULL.
something.Clear(*value);

So the test should be done *before* calling the Clear function if you want to keep the pass by reference semantics.

(Note that I haven't got refcount.hpp in the version of nmap I built, so I could be completely off-base here if Counted_ is actually defined to be a pointer in the first place).

--
Brett Hutley [MAppFin,CISSP,SANS GCIH]
mailto:brett () hutley net
http://hutley.net/brett



---------------------------------------------------------------------
For help using this (nmap-dev) mailing list, send a blank email to nmap-dev-help () insecure org . List run by ezmlm-idx (www.ezmlm.org).



Current thread: