[PATCH] checksum problem

Frédéric Raynal <[email protected]> Tue, 3 Aug 2004 15:18:29 +0200
Newsgroups gmane.comp.security.libnet
Message-ID <[email protected]>
Hi,

I've found a bug with the checksum ... due to me (/me stupid). The bug
was difficult to trace as it comes only when several packets were
built and a buffer passed to libnet_in_cksum() had an odd size.

It has been tested on Mac OS X and Linux x86. Let me know on other
arch please.

Anyway, here is the patch for this function.  Apply it as it may fix
troubles you had.

	Fred Raynal
be_checksum-v2.patch (text/plain, 281 B)
--- libnet/src/libnet_checksum.c	Sat Jan  3 21:31:02 2004
+++ libnet-fr/src/libnet_checksum.c	Wed Feb 11 10:22:34 2004
@@ -52,7 +52,7 @@
     }
     if (len == 1)
     {
-        sum += *(u_int16_t *)addr;
+        sum += htons(*(u_int8_t *)addr << 8);
     }
 
     return (sum);