Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong output value size for getnameinfo #45

Open
pw-fomin opened this issue Jan 28, 2019 · 1 comment
Open

Wrong output value size for getnameinfo #45

pw-fomin opened this issue Jan 28, 2019 · 1 comment
Assignees

Comments

@pw-fomin
Copy link

pw-fomin commented Jan 28, 2019

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:

        char host[65];
        RakNet::RakNetSocket2::DomainNameToIP( remoteIp, host );

with flag RAKNET_SUPPORT_IPV6 set to 1.

Call goes to method DomainNameToIP_Berkley_IPV4And6. In this method getaddrinfo called. On my machine first goes addrinfo from getaddrinfo with AF_INET6 family, so we goes to line 66:

And bug is here: we pass output parameter ip with size of 1 instead of sizeof(ip) to getnameinfo, 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

@Luke1410
Copy link
Member

Luke1410 commented Feb 9, 2019

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.

@Luke1410 Luke1410 self-assigned this Feb 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants