Home page logo
/

nmap-dev logo Nmap Development mailing list archives

Re: [PATCH] Remove useless variable assignment in tcpip.cc
From: Kris Katterjohn <kjak () ispwest com>
Date: Wed, 15 Mar 2006 10:47:36 -0600

Andreas Ericsson wrote:
On Tue, Mar 14, 2006 at 02:32:01PM -0600, Kris Katterjohn wrote:
The attached patch removes a useless assignment to a variable.


Thanks,
Kris

--- tcpip.cc.orig    2006-03-08 15:29:54.000000000 -0600
+++ tcpip.cc 2006-03-14 12:36:09.000000000 -0600
@@ -1179,7 +1179,6 @@ char *ping = (char *) &pingpkt;
 pingpkt.code = 0;
 pingpkt.id = id;
 pingpkt.seq = seq;
-pingpkt.checksum = 0;
 pingpkt.checksum = in_cksum((unsigned short *)ping, icmplen);
 


This is actually necessary. Since 'char *ping' points to pingpkt the
checksum has to be zero before calculating it. See RFC 791 or 792
(I think both have identical texts, or 792 references 791) for details.

It doesn't matter if pingpkt is in the bss but relying on such
things will cause hard-to-find bugs when bitrot strikes (nmap will
look like it's working, but some devices may refuse to respond when
the checksum is bogus).


Ah, I found it in RFC 791.

Thanks,
Kris


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


  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]
AlienVault