]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
fix improper aliasing
authorrussor <russor@whatsapp.com>
Mon, 18 Apr 2016 20:28:43 +0000 (13:28 -0700)
committerrussor <russor@whatsapp.com>
Mon, 18 Apr 2016 20:28:43 +0000 (13:28 -0700)
net.c

diff --git a/net.c b/net.c
index 418ff7a0969a17a37af0e646d6633d98bde4bb95..bdc5f85e7a544ace8cdeb7c8a28a33f25ef71d14 100644 (file)
--- a/net.c
+++ b/net.c
@@ -235,14 +235,11 @@ int checksum(void *data, int sz)
 {
   unsigned short *ch;
   unsigned int sum;
-  char odd[2];
 
   sum = 0;
   ch = data;
   if (sz % 2) {
-    odd[0] = ((char*)data)[sz - 1];
-    odd[1] = 0;
-    sum = *(unsigned short*)(void*)&odd;
+    ((char *)&sum)[0] = ((char *)data)[sz - 1];
   }
   sz = sz / 2;
   while (sz--) {