Mercurial > hg > freeDiameter
diff include/freeDiameter/libfdproto.h @ 1414:f6f12521c2aa
Fix strict-aliasing warnings with gcc 4.8
Rewrite IN6_ADDR_V4MAP() to not rely upon aliasing rules.
Add test for IN6_ADDR_V4MAP() and IN6_ADDR_V4UNMAP().
Rewrite MD5Final() to not rely upon aliasing rules. (Not tested)
author | Luke Mewburn <luke@mewburn.net> |
---|---|
date | Tue, 18 Feb 2020 19:01:49 +1100 |
parents | d4a4ab5239c7 |
children | b1e8c5281d29 |
line wrap: on
line diff
--- a/include/freeDiameter/libfdproto.h Tue Feb 18 18:38:00 2020 +1100 +++ b/include/freeDiameter/libfdproto.h Tue Feb 18 19:01:49 2020 +1100 @@ -689,10 +689,10 @@ /* create a V4MAPPED address */ #define IN6_ADDR_V4MAP( a6, a4 ) { \ - ((uint32_t *)(a6))[0] = 0; \ - ((uint32_t *)(a6))[1] = 0; \ - ((uint32_t *)(a6))[2] = htonl(0xffff); \ - ((uint32_t *)(a6))[3] = (uint32_t)(a4); \ + memset(&(*a6)[0], 0, 10); \ + (*a6)[10] = 0xff; \ + (*a6)[11] = 0xff; \ + memcpy(&(*a6)[12], &a4, 4); \ } /* Retrieve a v4 value from V4MAPPED address ( takes a s6_addr as param) */