Module: wine Branch: master Commit: 47d50bbbc23aeb10adf9f44215784c3f6c204b28 URL: https://source.winehq.org/git/wine.git/?a=commit;h=47d50bbbc23aeb10adf9f4421...
Author: Damjan Jovanovic damjan.jov@gmail.com Date: Sun Dec 27 11:39:18 2020 +0200
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
---
dlls/ws2_32/socket.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index 05097ce53b8..0579ede8772 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -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);