Open pw-fomin opened 5 years ago
Thanks for the clear report and description of the issue and sorry for the delay. Obviously you are correct and we applied the suggested solution to the current trunk/master version already (internal case number: SLNET-260). Changes are scheduled to be shipped in SLikeNet 0.2.0.
While building RakNet 4.081 i found a bug and looks like it still presents in SLikeNet. Bug can be reproduced if call this code:
with flag
RAKNET_SUPPORT_IPV6
set to 1.Call goes to method
DomainNameToIP_Berkley_IPV4And6
. In this methodgetaddrinfo
called. On my machine first goesaddrinfo
fromgetaddrinfo
withAF_INET6
family, so we goes to line 66:And bug is here: we pass output parameter
ip
with size of 1 instead ofsizeof(ip)
togetnameinfo
, so the correct code will be:getnameinfo((struct sockaddr *)ipv6, sizeof(struct sockaddr_in6), ip, sizeof(ip), NULL, 0, NI_NUMERICHOST);
getnameinfo
on MSDN - https://docs.microsoft.com/en-us/windows/desktop/api/ws2tcpip/nf-ws2tcpip-getnameinfo