harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Hindess" <mark.hind...@googlemail.com>
Subject [classlib][portlib] Bug in IPv6 native code?
Date Wed, 20 Aug 2008 10:59:39 GMT

In modules/portlib/src/main/native/port/unix/hysock.c on line 4821, I see:

  interfaces[currentAdapterIndex].
    addresses[currentIPAddressIndex].scope =
    &(((struct sockaddr_in6 *) (&ifc.ifc_req[counter].
                                ifr_addr))->
      sin6_scope_id);

but interfaces[currentAdapterIndex].addresses[currentIPAddressIndex].scope
is a U_32 as defined in modules/portlib/src/main/native/include/unix/hysock.h
on line 260.

So we are assigning an address to a U_32 which definitely isn't a good idea
on 64-bit platforms.  Even on 32-bit platforms I can't understand why we'd
want to do this.  The other assignment to the same field on line 4296 of
hysock.c looks like:

  interfaces[counter].
    addresses[currentIPAddressIndex].
    scope =
    returnedAddrHeader->ifa_index;

which seems a little more reasonable as ifa_index is also a U_32.

These definitely seem inconsistent but it is not immediately obvious to
me what the correct fix is.  Anyone any ideas?

Regards,
 Mark.


Mime
View raw message