Fixes a SIGSEGV by making sure `txt_chunk` is not empty before setting
it on `txt_records`
PR-URL: https://github.com/iojs/io.js/pull/960
Reviewed-By: Rod Vagg <rod@vagg.org>
}
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);
--- /dev/null
+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);
+});