From f1c455dfbc676a5f35249dc3c1aa7c09e12fe8e2 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Thu, 14 Nov 2013 10:29:14 +0000 Subject: [PATCH] Avoid pointer gymnastics. Thanks to Christos Zoulas. --- if-bsd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/if-bsd.c b/if-bsd.c index d7e466f8..c5c4c330 100644 --- a/if-bsd.c +++ b/if-bsd.c @@ -380,8 +380,9 @@ if_route6(const struct rt6 *rt, int action) #ifdef __KAME__ #define SCOPE { \ if (IN6_IS_ADDR_LINKLOCAL(&su.sin.sin6_addr)) { \ - *(uint16_t *)(void *)&su.sin.sin6_addr.s6_addr[2] = \ - htons(su.sin.sin6_scope_id); \ + uint16_t scope = htons(su.sin.sin6_scope_id); \ + memcpy(&su.sin.sin6_addr.s6_addr[2], &scope, \ + sizeof(scope)); \ su.sin.sin6_scope_id = 0; \ } \ } -- 2.47.3