You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by sf...@apache.org on 2015/08/16 16:14:42 UTC

svn commit: r1696140 - /apr/apr/trunk/network_io/unix/multicast.c

Author: sf
Date: Sun Aug 16 14:14:42 2015
New Revision: 1696140

URL: http://svn.apache.org/r1696140
Log:
fix comparison of sin6_addr

One cannot assume that sin6_addr is located at the start of sa_data.
For example, glibc puts sin6_flowinfo there.
Fix by casting to the proper type first.

Reported by Andre Naujoks <nautsch2 gmail com> via
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=759534

Modified:
    apr/apr/trunk/network_io/unix/multicast.c

Modified: apr/apr/trunk/network_io/unix/multicast.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/network_io/unix/multicast.c?rev=1696140&r1=1696139&r2=1696140&view=diff
==============================================================================
--- apr/apr/trunk/network_io/unix/multicast.c (original)
+++ apr/apr/trunk/network_io/unix/multicast.c Sun Aug 16 14:14:42 2015
@@ -65,7 +65,7 @@ static unsigned int find_if_index(const
     for (ifp = ifs; ifp; ifp = ifp->ifa_next) {
         if (ifp->ifa_addr != NULL && ifp->ifa_addr->sa_family == AF_INET6) {
             if (memcmp(&iface->sa.sin6.sin6_addr,
-                       &ifp->ifa_addr->sa_data[0],
+                       &((struct sockaddr_in6*)ifp->ifa_addr)->sin6_addr,
                        sizeof(iface->sa.sin6.sin6_addr)) == 0) {
                 index = if_nametoindex(ifp->ifa_name);
                 break;