Nmap Development mailing list archives

[PATCH] Use htons() instead of bitwise ops in idle_scan.cc


From: Kris Katterjohn <kjak () ispwest com>
Date: Mon, 21 Aug 2006 22:06:27 -0500

This uses htons() instead of some bitwise operations in ipid_distance()
in idle_scan.cc. Should be more portable.

It's a diff against 4.20ALPHA4

Thanks,
Kris Katterjohn


--- x/idle_scan.cc      2006-07-04 18:05:03.000000000 -0500
+++ y/idle_scan.cc      2006-08-21 21:59:16.000000000 -0500
@@ -254,8 +254,8 @@ static int ipid_distance(int seqclass ,

   if (seqclass == IPID_SEQ_BROKEN_INCR) {
     /* Convert to network byte order */
-    startid = (startid >> 8) + ((startid & 0xFF) << 8);
-    endid = (endid >> 8) + ((endid & 0xFF) << 8);
+    startid = htons(startid);
+    endid = htons(endid);
     return endid - startid;
   }


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


Current thread: