Skip to content

Commit

Permalink
net: use missing validator
Browse files Browse the repository at this point in the history
The `net` lib module's `lookupAndConnect()` function is missing
a validator.

PR-URL: #38984
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Zijian Liu <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Zeyu Yang <[email protected]>
  • Loading branch information
VoltrexKeyva authored and danielleadams committed Jun 15, 2021
1 parent 10370c5 commit 4174f13
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const {
const { isUint8Array } = require('internal/util/types');
const {
validateAbortSignal,
validateFunction,
validateInt32,
validateNumber,
validatePort,
Expand Down Expand Up @@ -1002,10 +1003,8 @@ function lookupAndConnect(self, options) {
return;
}

if (options.lookup && typeof options.lookup !== 'function')
throw new ERR_INVALID_ARG_TYPE('options.lookup',
'Function', options.lookup);

if (options.lookup !== undefined)
validateFunction(options.lookup, 'options.lookup');

if (dns === undefined) dns = require('dns');
const dnsopts = {
Expand Down

0 comments on commit 4174f13

Please sign in to comment.