Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DnsServiceBrowse uses incorrect version of DNS_RECORD #755

Closed
thhous-msft opened this issue Nov 24, 2021 · 1 comment
Closed

DnsServiceBrowse uses incorrect version of DNS_RECORD #755

thhous-msft opened this issue Nov 24, 2021 · 1 comment
Assignees
Labels
broken api An API is inaccurate and could lead to runtime failure

Comments

@thhous-msft
Copy link

Actual behavior

The pDnsRecord parameter of PDNS_SERVICE_BROWSE_CALLBACK (Which is a field of DNS_SERVICE_BROWSE_REQUEST) points to DNS_RECORDA

Expected behavior

The pDnsRecord parameter of PDNS_SERVICE_BROWSE_CALLBACK (Which is a field of DNS_SERVICE_BROWSE_REQUEST) points to DNS_RECORDW

Repro steps

  1. NativeMethods.txt content:
DnsServiceBrowse

Due to a bug in the dns header, this function only works if UNICODE is defined, causing the DNS_RECORD field in the PDNS_SERVICE_BROWSE_CALLBACK parameter to be a DNS_RECORDW. The DNS code always passes a DNS_RECORDW to the callback, so a caller expecting DNS_RECORDA will see bad string values. DNS_SERVICE_BROWSE_REQUEST needs to always assume UNICODE is defined and use DNS_RECORDW.

Context

  • CsWin32 version: [e.g. 0.1.619-beta]
  • Target Framework: [e.g. net6.0]
@AArnott AArnott transferred this issue from microsoft/CsWin32 Nov 24, 2021
@AArnott AArnott added the broken api An API is inaccurate and could lead to runtime failure label Nov 24, 2021
@mikebattista mikebattista self-assigned this Nov 29, 2021
@kennykerr
Copy link
Contributor

I'd take another look at this fix. The parameter not only changed type but also dropped the pointer from its signature. That seems to not line up with the headers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
broken api An API is inaccurate and could lead to runtime failure
Projects
None yet
Development

No branches or pull requests

4 participants