mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
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>
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -11,7 +11,7 @@ const answers = [
|
||||
{ type: 'AAAA', address: '::42', ttl: 123 },
|
||||
{ type: 'MX', priority: 42, exchange: 'foobar.com', ttl: 124 },
|
||||
{ type: 'NS', value: 'foobar.org', ttl: 457 },
|
||||
{ type: 'TXT', entries: [ 'v=spf1 ~all', 'xyz' ] },
|
||||
{ type: 'TXT', entries: [ 'v=spf1 ~all', 'xyz\0foo' ] },
|
||||
{ type: 'PTR', value: 'baz.org', ttl: 987 },
|
||||
{
|
||||
type: 'SOA',
|
||||
|
||||
Reference in New Issue
Block a user