Fix setsockopt() for IPV6_MULTICAST_IF

32bit: sizeof(&ifindex) == sizeof(void *) == 4
64bit: sizeof(&ifindex) == sizeof(void *) == 8

As a result, it is "ifindex" oob acces on 64bit platforms.
This commit is contained in:
Maks Naumov 2015-01-21 15:31:57 +02:00 committed by Thomas Bernard
parent 241ede9ddf
commit 81dc08d290
1 changed files with 1 additions and 1 deletions

View File

@ -501,7 +501,7 @@ upnpDiscoverDevices(const char * const deviceTypes[],
* MS Windows Vista and MS Windows Server 2008.
* http://msdn.microsoft.com/en-us/library/bb408409%28v=vs.85%29.aspx */
unsigned int ifindex = if_nametoindex(multicastif); /* eth0, etc. */
if(setsockopt(sudp, IPPROTO_IPV6, IPV6_MULTICAST_IF, &ifindex, sizeof(&ifindex)) < 0)
if(setsockopt(sudp, IPPROTO_IPV6, IPV6_MULTICAST_IF, &ifindex, sizeof(ifindex)) < 0)
{
PRINT_SOCKET_ERROR("setsockopt");
}