diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-11-27 23:51:54 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-11-30 05:58:30 +0300 |
commit | f37450f58075bcc2ec2c04fae40b874683eb418c (patch) | |
tree | 5b20efc62261cff75e8047fd18eb89231479f6f4 /src | |
parent | 099d3fdf87e612933a60d282446b5650565112d2 (diff) |
dns: use length for building TXT string
Rely on the length reported by C-Ares rather than `\0`-termination
for creating the JS string for a dns TXT response.
Fixes: https://github.com/nodejs/node/issues/30688
PR-URL: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'src')
-rw-r--r-- | src/cares_wrap.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 1fb0f47dd80..f7a02e469aa 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -904,7 +904,8 @@ int ParseTxtReply(Environment* env, uint32_t i = 0, j; uint32_t offset = ret->Length(); for (j = 0; current != nullptr; current = current->next) { - Local<String> txt = OneByteString(env->isolate(), current->txt); + Local<String> txt = + OneByteString(env->isolate(), current->txt, current->length); // New record found - write out the current chunk if (current->record_start) { |