This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The method GetAddrInfo() is used by more than just dns.lookup(), and in those cases a third argument isn't passed. This caused the following check to abort: assert(args[3]->IsInt32()); Fixes: 4306786 "net: don't prefer IPv4 addresses during resolution" Signed-off-by: Trevor Norris <trev.norris@gmail.com>
- Loading branch information
1 parent
4306786
commit e643fe4
Showing
2 changed files
with
2 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,17 +102,14 @@ function onlookup(err, addresses) { | |
// lookup(hostname, [options,] callback) | ||
exports.lookup = function lookup(hostname, options, callback) { | ||
var hints = 0; | ||
var family; | ||
var family = 0; | ||
|
||
// Parse arguments | ||
if (typeof options === 'function') { | ||
callback = options; | ||
family = 0; | ||
// Allow user to pass falsy values to options, and still pass callback. | ||
} else if (typeof callback !== 'function') { | ||
throw TypeError('invalid arguments: callback must be passed'); | ||
} else if (!options) { | ||
family = 0; | ||
} else if (util.isObject(options)) { | ||
hints = options.hints >>> 0; | ||
family = options.family >>> 0; | ||
|
@@ -123,8 +120,6 @@ exports.lookup = function lookup(hostname, options, callback) { | |
hints !== (exports.ADDRCONFIG | exports.V4MAPPED)) { | ||
throw new TypeError('invalid argument: hints must use valid flags'); | ||
} | ||
} else { | ||
family = options >>> 0; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
trevnorris
Author
|
||
} | ||
|
||
if (family !== 0 && family !== 4 && family !== 6) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Removing this else block broke passing an integer as the second argument (options). Was that the intention? If so the documentation (and tests) should be updated as well