Module: wine Branch: stable Commit: f206f787da22cd229a4d4eea19931cf7df743cac URL: https://gitlab.winehq.org/wine/wine/-/commit/f206f787da22cd229a4d4eea19931cf...
Author: Hans Leidekker hans@codeweavers.com Date: Wed Apr 12 15:17:10 2023 +0200
ws2_32: Skip non-address records in dns_only_query().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54819 (cherry picked from commit f512b3c08ccfc9b9c235964002e644e2cbd657cf)
---
dlls/ws2_32/protocol.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/ws2_32/protocol.c b/dlls/ws2_32/protocol.c index 1f840832c7a..f746257a4fc 100644 --- a/dlls/ws2_32/protocol.c +++ b/dlls/ws2_32/protocol.c @@ -96,8 +96,8 @@ static int dns_only_query( const char *node, const struct addrinfo *hints, struc } }
- for (ptr = rec; ptr; ptr = ptr->pNext) count++; - for (ptr = rec6; ptr; ptr = ptr->pNext) count++; + for (ptr = rec; ptr; ptr = ptr->pNext) { if (ptr->wType == DNS_TYPE_A) count++; }; + for (ptr = rec6; ptr; ptr = ptr->pNext) { if (ptr->wType == DNS_TYPE_AAAA) count++; }; if (!count) { DnsRecordListFree( (DNS_RECORD *)rec, DnsFreeRecordList ); @@ -114,6 +114,7 @@ static int dns_only_query( const char *node, const struct addrinfo *hints, struc
for (ptr = rec; ptr; ptr = ptr->pNext) { + if (ptr->wType != DNS_TYPE_A) continue; info->ai_family = AF_INET; info->ai_socktype = hints->ai_socktype; info->ai_protocol = hints->ai_protocol; @@ -128,6 +129,7 @@ static int dns_only_query( const char *node, const struct addrinfo *hints, struc } for (ptr = rec6; ptr; ptr = ptr->pNext) { + if (ptr->wType != DNS_TYPE_AAAA) continue; info->ai_family = AF_INET6; info->ai_socktype = hints->ai_socktype; info->ai_protocol = hints->ai_protocol;