]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
copy odd byte into a 16-bit temp value; used bit-sized types for calrity
authorrussor <russor@whatsapp.com>
Mon, 18 Apr 2016 22:13:21 +0000 (15:13 -0700)
committerrussor <russor@whatsapp.com>
Mon, 18 Apr 2016 22:13:21 +0000 (15:13 -0700)
net.c

diff --git a/net.c b/net.c
index 66319e26324607e6c496e5c702a1b278ff2cf48e..f743492457593302bf917f84e5ea7a553bd424dd 100644 (file)
--- a/net.c
+++ b/net.c
@@ -233,13 +233,15 @@ int calc_deltatime (float waittime)
 
 int checksum(void *data, int sz) 
 {
-  unsigned short *ch;
-  unsigned int sum;
+  uint16 *ch;
+  uint32 sum;
+  uint16 odd;
 
   sum = 0;
   ch = data;
   if (sz % 2) {
-    ((char *)&sum)[0] = ((char *)data)[sz - 1];
+    ((char *)&odd)[0] = ((char *)data)[sz - 1];
+    sum = odd;
   }
   sz = sz / 2;
   while (sz--) {