From: russor Date: Mon, 18 Apr 2016 20:28:43 +0000 (-0700) Subject: fix improper aliasing X-Git-Tag: v0.87~12^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=26e4bef7ca5972405875c4cefa581a390bffd25e;p=thirdparty%2Fmtr.git fix improper aliasing --- diff --git a/net.c b/net.c index 418ff7a..bdc5f85 100644 --- 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--) {