Nmap Security Scanner
*Intro
*Ref Guide
*Install Guide
*Download
*Changelog
*Book
*Docs
Security Lists
*Nmap Hackers
*Nmap Dev
*Bugtraq
*Full Disclosure
*Pen Test
*Basics
*More
Security Tools
*Pass crackers
*Sniffers
*Vuln Scanners
*Web scanners
*Wireless
*Exploitation
*Packet crafters
*More
Site News
Site Search:
Exploit World
Advertising
About/Contact
Credits
Sponsors:
edgeos



Nmap Development: Re: [checker] nmap: possible memory leak in nsi_new2

Re: [checker] nmap: possible memory leak in nsi_new2

From: Fyodor <fyodor_at_insecure.org>
Date: Tue, 2 May 2006 02:04:40 -0700

On Tue, May 02, 2006 at 01:25:26AM -0700, Ted Kremenek wrote:
> Hello again,
>
> My tool flagged another potential memory leak in nsi_new2 when the
> call to dup() fails:

Verified and fixed:

Index: nsock_iod.c
===================================================================
--- nsock_iod.c (revision 2656)
+++ nsock_iod.c (working copy)
@@ -95,7 +95,10 @@
     nsi->state = NSIOD_STATE_INITIAL;
   } else {
     nsi->sd = dup(sd);
- if (nsi->sd == -1) return NULL;
+ if (nsi->sd == -1) {
+ free(nsi);
+ return NULL;
+ }
     nsock_unblock_socket(nsi->sd);
     nsi->state = NSIOD_STATE_UNKNOWN;
   }

(Freeing nsi is OK, even if it came from the nsp->free_iods list
rather than the safe_malloc directly).

Thanks,
Fyodor

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Received on May 02 2006

[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]
edgeos