| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1311,6 +1311,8 @@ function lookupAndConnect(self, options) { | |||
| 1311 | 1311 | const host = options.host || 'localhost'; | |
| 1312 | 1312 | let { port, autoSelectFamilyAttemptTimeout, autoSelectFamily } = options; | |
| 1313 | 1313 | ||
| 1314 | + validateString(host, 'options.host'); | ||
| 1315 | + | ||
| 1314 | 1316 | if (localAddress && !isIP(localAddress)) { | |
| 1315 | 1317 | throw new ERR_INVALID_IP_ADDRESS(localAddress); | |
| 1316 | 1318 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,3 +25,15 @@ const net = require('net'); | |||
| 25 | 25 | }); | |
| 26 | 26 | }); | |
| 27 | 27 | } | |
| 28 | + | ||
| 29 | + { | ||
| 30 | + assert.throws(() => { | ||
| 31 | + net.createConnection({ | ||
| 32 | + host: ['192.168.0.1'], | ||
| 33 | + port: 8080, | ||
| 34 | + }); | ||
| 35 | + }, { | ||
| 36 | + code: 'ERR_INVALID_ARG_TYPE', | ||
| 37 | + name: 'TypeError', | ||
| 38 | + }); | ||
| 39 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments