Skip to content

Commit 84277ea

Browse files
blazzyry
authored andcommitted
Check for callback argument in PTR lookup
1 parent 31ed37f commit 84277ea

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/node_dns.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,11 @@ static Handle<Value> Reverse(const Arguments& args) {
443443
String::New("Argument must be a string.")));
444444
}
445445

446+
if (!args[1]->IsFunction()) {
447+
return ThrowException(Exception::Error(
448+
String::New("Missing callback argument")));
449+
}
450+
446451
String::Utf8Value ip_address(args[0]->ToString());
447452

448453
union {

test/disabled/test-dns.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ var dns = require("dns"),
88

99
assert.throws(function () {
1010
dns.resolve('google.com', 'A');
11-
})
11+
});
12+
assert.throws(function () {
13+
dns.resolve('127.0.0.1', 'PTR');
14+
});
1215

1316

1417
var hosts = ['example.com', 'example.org',

0 commit comments

Comments
 (0)