| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6b45bf3 commit 90abdd3
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1051,6 +1051,9 @@ function lookupAndConnect(self, options) { | |||
| 1051 | 1051 | // calls net.Socket.connect() on it (that's us). There are no event | |
| 1052 | 1052 | // listeners registered yet so defer the error event to the next tick. | |
| 1053 | 1053 | process.nextTick(connectErrorNT, self, err); | |
| 1054 | + } else if (!isIP(ip)) { | ||
| 1055 | + err = new ERR_INVALID_IP_ADDRESS(ip); | ||
| 1056 | + process.nextTick(connectErrorNT, self, err); | ||
| 1054 | 1057 | } else if (addressType !== 4 && addressType !== 6) { | |
| 1055 | 1058 | err = new ERR_INVALID_ADDRESS_FAMILY(addressType, | |
| 1056 | 1059 | options.host, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -41,3 +41,14 @@ function check(addressType, cb) { | |||
| 41 | 41 | check(4, function() { | |
| 42 | 42 | common.hasIPv6 && check(6); | |
| 43 | 43 | }); | |
| 44 | + | ||
| 45 | + // Verify that bad lookup() IPs are handled. | ||
| 46 | + { | ||
| 47 | + net.connect({ | ||
| 48 | + host: 'localhost', | ||
| 49 | + port: 80, | ||
| 50 | + lookup(host, dnsopts, cb) { | ||
| 51 | + cb(null, undefined, 4); | ||
| 52 | + } | ||
| 53 | + }).on('error', common.expectsError({ code: 'ERR_INVALID_IP_ADDRESS' })); | ||
| 54 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments