Nmap Development mailing list archives
Re: [PATCH] Remove useless variable assignment in tcpip.cc
From: Andreas Ericsson <ae () op5 se>
Date: Wed, 15 Mar 2006 10:47:45 +0100
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). -- Andreas Ericsson andreas.ericsson () op5 se OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231 _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev
Current thread:
- [PATCH] Remove useless variable assignment in tcpip.cc Kris Katterjohn (Mar 14)
- Re: [PATCH] Remove useless variable assignment in tcpip.cc Andreas Ericsson (Mar 15)
- Re: [PATCH] Remove useless variable assignment in tcpip.cc Kris Katterjohn (Mar 15)
- Re: [PATCH] Remove useless variable assignment in tcpip.cc Andreas Ericsson (Mar 15)