ws2_32: Deal with getaddrinfo() returning NULL ai_canonname despite AI_CANONNAME.

This fixes a wineboot crash on FreeBSD, where getaddrinfo() returns a NULL
ai_canonname, causing wineboot to pass NULL to strchr().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50408
Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Damjan Jovanovic 2020-12-27 11:39:18 +02:00 committed by Alexandre Julliard
parent 41dfe7cc67
commit 47d50bbbc2
1 changed files with 5 additions and 0 deletions

View File

@ -6616,6 +6616,11 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
* is invalid */
ERR_(winediag)("Failed to resolve your host name IP\n");
result = getaddrinfo(NULL, servname ? servname : "0", punixhints, &unixaires);
if (!result && punixhints && (punixhints->ai_flags & AI_CANONNAME) && unixaires && !unixaires->ai_canonname)
{
freeaddrinfo(unixaires);
result = EAI_NONAME;
}
}
}
TRACE("%s, %s %p -> %p %d\n", debugstr_a(nodename), debugstr_a(servname), hints, res, result);