mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
src: fix intermittent SIGSEGV in resolveTxt
Fixes a SIGSEGV by making sure `txt_chunk` is not empty before setting it on `txt_records` Fixes: https://github.com/joyent/node/issues/9285 PR-URL: https://github.com/joyent/node/pull/9300 Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com> Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
1f7257b02d
commit
261fa3620f
2 files changed
+11
-2
No files matched your search
+3
-2
@@ -633,8 +633,9 @@ class QueryTxtWrap: public QueryWrap {
|
||||
}
|
||||
txt_chunk->Set(j++, txt);
|
||||
}
|
||||
// Push last chunk
|
||||
txt_records->Set(i, txt_chunk);
|
||||
// Push last chunk if it isn't empty
|
||||
if (!txt_chunk.IsEmpty())
|
||||
txt_records->Set(i, txt_chunk);
|
||||
|
||||
ares_free_data(txt_out);
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
var common = require('../common');
|
||||
var assert = require('assert');
|
||||
var dns = require('dns');
|
||||
|
||||
dns.resolveTxt('www.microsoft.com', function(err, records) {
|
||||
assert.equal(err, null);
|
||||
assert.equal(records.length, 0);
|
||||
});
|
||||
Reference in new issue
Block a user