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: [NmapFE PATCH] Remove some bogus if (...) realloc() code from nmapfe_sig.c

[NmapFE PATCH] Remove some bogus if (...) realloc() code from nmapfe_sig.c

From: Kris Katterjohn <kjak_at_ispwest.com>
Date: Sun, 01 Oct 2006 21:40:32 -0500

The attached patch removes some weird, unneeded code.

It currently calls realloc(command, 2560) EVERY time the function is
called because command_size never changes. This just calls malloc(2560)
 the first time and removes the extra variables.

It's a diff against 4.20ALPHA8

Thanks,
Kris Katterjohn

--- x/nmapfe/nmapfe_sig.c 2006-09-26 02:49:21.000000000 -0500
+++ y/nmapfe/nmapfe_sig.c 2006-10-01 21:33:37.000000000 -0500
@@ -236,9 +236,7 @@ static char *next_token(char *buf, char
 
 static char *build_command()
 {
-int size = 2560; /* this should be long enough ;-) */
 static char *command = NULL;
-static int command_size = 0;
 
   /* Find how much to malloc() */
   // size = strlen(gtk_entry_get_text(GTK_ENTRY(opt.range_text))) +
@@ -250,8 +248,8 @@ static int command_size = 0;
   // 2560;
   /* We get 60 from the chars required for each option */
 
- if (size > command_size)
- command = realloc(command, size);
+ if (!command)
+ command = malloc(2560); /* this should be long enough ;-) */
 
   strcpy(command, "nmap ");
  

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org
Received on Oct 01 2006

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