Nmap Development mailing list archives

Re: nmap 3.3+V-2.99


From: Fyodor <fyodor () insecure org>
Date: Thu, 4 Sep 2003 00:27:22 -0700

On Mon, Sep 01, 2003 at 12:54:23AM +0200, Gisle Vanem wrote:

Here's some patches that works for me:


Thanks for the patch.  The utils.cc part applies to base Nmap as
opposed to just Saurik's Nmap+V.  I have applied most of it for the
next version.  The only chunk I didn't apply is:

@@ -655,12 +678,13 @@
    works if the file is the most recently mapped one */
 int win32_munmap(char *filestr, int filelen)
 {
- if(gmap == 0)
-  fatal("win32_munmap: no current mapping !\n");
- FlushViewOfFile(filestr, filelen);
- UnmapViewOfFile(filestr);
- CloseHandle(gmap);
- gmap = 0;
+ if(gmap)
+ {
+  FlushViewOfFile(filestr, filelen);
+  UnmapViewOfFile(filestr);
+  CloseHandle(gmap);
+ }
+ gmap = NULL;
  return 0;
 }


Is there a good reason for not bailing if gmap is NULL?  The point is
to detect cases where the code munmap's a file that it hasn't even
mmap'd (or if it munmaps a file twice).  Other than these cases of API
misuse, does the (gmap == 0) check cause any problems?

Thanks,
Fyodor

---------------------------------------------------------------------
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: