summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDenis Ovsienko <infrastation@yandex.ru>2011-12-18 15:40:17 +0400
committerDenis Ovsienko <infrastation@yandex.ru>2012-01-02 18:37:54 +0400
commitfe40bfa2e1b913e24d6b8374fd83a19d00ad7c1c (patch)
treea804e85ac21df3fa613be8fed54f2c6cff830459 /lib
parent733cd9e5792648de50da3c00805aacb51cb27048 (diff)
lib: address type-punned pointers in prefix_same()
IPV4_ADDR_SAME() wasn't passed the right union member, this could cause a bug due to strict-aliasing. IPV6_ADDR_SAME() case got its fix before the error could be created by macro upgrade.
Diffstat (limited to 'lib')
-rw-r--r--lib/prefix.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/prefix.c b/lib/prefix.c
index 580ba31a..1b1c6626 100644
--- a/lib/prefix.c
+++ b/lib/prefix.c
@@ -2411,11 +2411,11 @@ prefix_same (const struct prefix *p1, const struct prefix *p2)
if (p1->family == p2->family && p1->prefixlen == p2->prefixlen)
{
if (p1->family == AF_INET)
- if (IPV4_ADDR_SAME (&p1->u.prefix, &p2->u.prefix))
+ if (IPV4_ADDR_SAME (&p1->u.prefix4.s_addr, &p2->u.prefix4.s_addr))
return 1;
#ifdef HAVE_IPV6
if (p1->family == AF_INET6 )
- if (IPV6_ADDR_SAME (&p1->u.prefix, &p2->u.prefix))
+ if (IPV6_ADDR_SAME (&p1->u.prefix6.s6_addr, &p2->u.prefix6.s6_addr))
return 1;
#endif /* HAVE_IPV6 */
}