diff --git a/src/node_dns.cc b/src/node_dns.cc index 8bb440a258..3898c1aff0 100644 --- a/src/node_dns.cc +++ b/src/node_dns.cc @@ -443,6 +443,11 @@ static Handle Reverse(const Arguments& args) { String::New("Argument must be a string."))); } + if (!args[1]->IsFunction()) { + return ThrowException(Exception::Error( + String::New("Missing callback argument"))); + } + String::Utf8Value ip_address(args[0]->ToString()); union { diff --git a/test/disabled/test-dns.js b/test/disabled/test-dns.js index 7985728d22..f43ba5b832 100644 --- a/test/disabled/test-dns.js +++ b/test/disabled/test-dns.js @@ -8,7 +8,10 @@ var dns = require("dns"), assert.throws(function () { dns.resolve('google.com', 'A'); -}) +}); +assert.throws(function () { + dns.resolve('127.0.0.1', 'PTR'); +}); var hosts = ['example.com', 'example.org',