[PATCH] ws2_32: deal with getaddrinfo() returning NULL ai_canonname despite AI_CANONNAME
Damjan Jovanovic
damjan.jov at gmail.com
Sun Dec 27 03:39:18 CST 2020
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 at gmail.com>
---
dlls/ws2_32/socket.c | 6 ++++++
1 file changed, 6 insertions(+)
-------------- next part --------------
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 05097ce53b8..c1e71112993 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -6616,6 +6616,12 @@ 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);
+ /* Sometimes getaddrinfo() doesn't honor AI_CANONNAME and returns a NULL ai_canonname */
+ 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);
More information about the wine-devel
mailing list