dns: throw a TypeError in lookupService with invalid port
authorEvan Lucas <evanlucas@me.com>
Sun, 24 Jan 2016 14:58:56 +0000 (08:58 -0600)
committerMyles Borins <mborins@us.ibm.com>
Wed, 2 Mar 2016 22:01:11 +0000 (14:01 -0800)
commitd4f0f3fa0dfe853b1b90efad114c9448913e235b
treec5967fe065af30e5de57f7f7da546ff44757d42a
parent242d3bc3124cce107c6b4bba95729fef1f1b1d49
dns: throw a TypeError in lookupService with invalid port

Previously, port was assumed to be a number and would cause an abort in
cares_wrap. This change throws a TypeError if port is not a number
before we actually hit C++.

Fixes: https://github.com/nodejs/node/issues/4837
PR-URL: https://github.com/nodejs/node/pull/4839
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
lib/dns.js
test/parallel/test-dns.js