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

dns: invalid TXT response #30688

Closed
reklatsmasters opened this issue Nov 27, 2019 · 1 comment
Closed

dns: invalid TXT response #30688

reklatsmasters opened this issue Nov 27, 2019 · 1 comment
Labels
dns Issues and PRs related to the dns subsystem.

Comments

@reklatsmasters
Copy link
Contributor

  • Version: checked in 12.13.0
  • Platform: all?
  • Subsystem: dns

Let's look at QUAD9 dnscrypt certificate using dig:

$ dig @9.9.9.10 2.dnscrypt-cert.quad9.net TXT -p 8443 +short
"DNSC\000\001\000\000\246}Y\184\001+\209$!\177)1A7\214\026\219 \145p\252R1\013\213l\003\004+s;\012\165<\005;\002X\155\156T\228\158\0073C\\`\244#\179\158#T\196\030\207\244\138\209\167\020\254\005g\254If`Tz\171\139\182\225mr\180\021*\190l\170!!\155Di\251\144\228\131cA|Rg\254If`Tz\171xW\215l\\v\149I^Z\251\000"

and using nodejs:

const dns = require('dns');

dns.setServers(['9.9.9.10:8443']);
dns.resolveTxt('2.dnscrypt-cert.quad9.net', (err, record) => {
  console.log(err, record); // null [ [ 'DNSC' ] ]
});

Nodejs should return the whole buffer instead of a C string.

@addaleax addaleax added the dns Issues and PRs related to the dns subsystem. label Nov 27, 2019
addaleax added a commit to addaleax/node that referenced this issue Nov 27, 2019
Rely on the length reported by C-Ares rather than `\0`-termination
for creating the JS string for a dns TXT response.

Fixes: nodejs#30688
@addaleax
Copy link
Member

#30690 should address this, thanks for reporting!

addaleax added a commit that referenced this issue Nov 30, 2019
Rely on the length reported by C-Ares rather than `\0`-termination
for creating the JS string for a dns TXT response.

Fixes: #30688

PR-URL: #30690
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this issue Dec 5, 2019
Rely on the length reported by C-Ares rather than `\0`-termination
for creating the JS string for a dns TXT response.

Fixes: #30688

PR-URL: #30690
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this issue Dec 17, 2019
Rely on the length reported by C-Ares rather than `\0`-termination
for creating the JS string for a dns TXT response.

Fixes: #30688

PR-URL: #30690
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dns Issues and PRs related to the dns subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants