https://bugs.winehq.org/show_bug.cgi?id=54998
Bug ID: 54998 Summary: DnsQuery(DNS_TYPE_SRV) fails to parse some of the server answers Product: Wine Version: 8.9 Hardware: x86-64 OS: Linux Status: NEW Keywords: patch, source Severity: normal Priority: P2 Component: dnsapi Assignee: wine-bugs@winehq.org Reporter: dmitry@baikal.ru Distribution: ---
Created attachment 74551 --> https://bugs.winehq.org/attachment.cgi?id=74551 patch
An application that uses ActiveDs sometimes fails to get domain DC using DsGetDcNameW(). That's caused by a failing call to DnsQuery("_ldap._tcp.dc._msdcs.domain.com", DNS_TYPE_SRV) which in turn fails because DnsExtractRecordsFromMessage_UTF8() fails to parse some of the server answers.
It looks like this happens because in the DNS_TYPE_SRV record name is the last element, and in that case get_name() uses wrong boundary check and returns NULL.
Just in case it will be useful I'm attaching my version of the fix with some tests.
It seems that skip_name() also uses wrong boundary check, however usually some other data follows the skipped name, so it currently doesn't cause failures.