diff options
| author | Ron <ron@debian.org> | 2009-06-27 04:44:28 +0930 |
|---|---|---|
| committer | Austin Foxley <austinf@cetoncorp.com> | 2009-07-09 01:36:17 -0700 |
| commit | 83285a67dca1a4988ce77299ea982ddb63feab20 (patch) | |
| tree | 8605993c4ce5530bd3f208625bd3d6101e2aa9af /libc/inet/getaddrinfo.c | |
| parent | c06d418fa75cc20a3f12576818b4d77f1c4cfdcb (diff) | |
| download | uClibc-alpine-83285a67dca1a4988ce77299ea982ddb63feab20.tar.bz2 uClibc-alpine-83285a67dca1a4988ce77299ea982ddb63feab20.tar.xz | |
Avoid type-punned pointers that break strict-aliasing
Signed-off-by: Ron Lee <ron@debian.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
Diffstat (limited to 'libc/inet/getaddrinfo.c')
| -rw-r--r-- | libc/inet/getaddrinfo.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libc/inet/getaddrinfo.c b/libc/inet/getaddrinfo.c index 0ac29e662..e3016f63c 100644 --- a/libc/inet/getaddrinfo.c +++ b/libc/inet/getaddrinfo.c @@ -543,7 +543,8 @@ gaih_inet(const char *name, const struct gaih_service *service, if (scope_delim != NULL) { int try_numericscope = 0; - if (IN6_IS_ADDR_LINKLOCAL(at->addr) || IN6_IS_ADDR_MC_LINKLOCAL(at->addr)) { + uint32_t *a32 = (uint32_t*)at->addr; + if (IN6_IS_ADDR_LINKLOCAL(a32) || IN6_IS_ADDR_MC_LINKLOCAL(at->addr)) { at->scopeid = if_nametoindex(scope_delim + 1); if (at->scopeid == 0) try_numericscope = 1; @@ -621,8 +622,10 @@ gaih_inet(const char *name, const struct gaih_service *service, #endif if (req->ai_family == 0 || req->ai_family == AF_INET) { atr->family = AF_INET; - if ((req->ai_flags & AI_PASSIVE) == 0) - *(uint32_t*)atr->addr = htonl(INADDR_LOOPBACK); + if ((req->ai_flags & AI_PASSIVE) == 0) { + uint32_t *a = (uint32_t*)atr->addr; + *a = htonl(INADDR_LOOPBACK); + } } } |
