Nmap Development mailing list archives

[PATCH] Use Strncpy() instead of strncpy() placing NULL byte in nmap.cc


From: Kris Katterjohn <kjak () ispwest com>
Date: Thu, 14 Sep 2006 16:53:32 -0500

The attached patch uses Strncpy() instead of using strncpy() and placing
the NULL byte at the end of 'o.device'. I also used 'sizeof(o.device)'
instead of "63" ("64" should be passed to Strncpy() anyway).

It's a diff against 4.20ALPHA7

Thanks,
Kris Katterjohn
--- x/nmap.cc   2006-09-11 22:33:34.000000000 -0500
+++ y/nmap.cc   2006-09-14 16:47:02.000000000 -0500
@@ -856,7 +856,7 @@ int nmap_main(int argc, char *argv[]) {
       }
       break;
     case 'e': 
-      strncpy(o.device, optarg,63); o.device[63] = '\0'; break;
+      Strncpy(o.device, optarg, sizeof(o.device)); break;
     case 'F': fastscan++; break;
     case 'f': o.fragscan += 8; break;
     case 'g': 

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

Current thread: