From 84277ea84544d9999e7fea3eec30abada673f7c8 Mon Sep 17 00:00:00 2001 From: Krishna Rajendran Date: Wed, 17 Mar 2010 01:13:45 -0400 Subject: [PATCH] Check for callback argument in PTR lookup --- src/node_dns.cc | 5 +++++ test/disabled/test-dns.js | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) 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',