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 <duhamelantoine1995@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
  • 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.