diff options
author | cjihrig <cjihrig@gmail.com> | 2016-01-15 16:54:13 -0500 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2016-01-18 09:53:35 -0500 |
commit | 8bad51977ae63e21a5975e6f4a5b908afd5c5cc6 (patch) | |
tree | 339d280fb60546de5a4ad40f46a82a6e4815ecd4 /src/cares_wrap.cc | |
parent | 761cf2bf6a67307bb234a10b10fccdfd7893575c (diff) | |
download | android-node-v8-8bad51977ae63e21a5975e6f4a5b908afd5c5cc6.tar.gz android-node-v8-8bad51977ae63e21a5975e6f4a5b908afd5c5cc6.tar.bz2 android-node-v8-8bad51977ae63e21a5975e6f4a5b908afd5c5cc6.zip |
src: return UV_EAI_NODATA on empty lookup
AfterGetAddrInfo() can potentially return an empty array of
results without setting an error value. The JavaScript layer
expects the array to have at least one value if an error is
not returned. This commit sets a UV_EAI_NODATA error when an
empty result array is detected.
Fixes: https://github.com/nodejs/node/issues/4545
PR-URL: https://github.com/nodejs/node/pull/4715
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Diffstat (limited to 'src/cares_wrap.cc')
-rw-r--r-- | src/cares_wrap.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 8f57dfe477..46636c528b 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -983,6 +983,10 @@ void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) { address = address->ai_next; } + // No responses were found to return + if (n == 0) { + argv[0] = Integer::New(env->isolate(), UV_EAI_NODATA); + } argv[1] = results; } |