dns: prevent undefined values in results
authorJunliang Yan <jyan@ca.ibm.com>
Fri, 6 Nov 2015 18:46:16 +0000 (13:46 -0500)
committerJames M Snell <jasnell@gmail.com>
Wed, 23 Dec 2015 16:38:33 +0000 (08:38 -0800)
commite1cefda70fe27ac5771780f0491acb139594a7bb
tree8f74975b47a0821808ade9b8c8881f089ff6f984
parent301e166d20c654058c816800075edecc0e1657fe
dns: prevent undefined values in results

When getaddrinfo linked-list results contain entries other than AF_INET
and AF_INET6, the resulting v8::Array will contain undefined values.
That's because initialization of v8::Array pre-allocates entries for all
linked-list nodes, but not all of them will be in the final results.
This commit ensures that the array only contains valid results.

PR-URL: https://github.com/nodejs/node/pull/3696
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
src/cares_wrap.cc