-
-
Notifications
You must be signed in to change notification settings - Fork 34.3k
net: fix abort on bad address input #13726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,12 +2,20 @@ | |
| const common = require('../common'); | ||
| const net = require('net'); | ||
| const assert = require('assert'); | ||
| const fp = '/tmp/fadagagsdfgsdf'; | ||
| const c = net.connect(fp); | ||
|
|
||
| c.on('connect', common.mustNotCall()); | ||
| { | ||
| const fp = '/tmp/fadagagsdfgsdf'; | ||
| const c = net.connect(fp); | ||
|
|
||
| c.on('error', common.mustCall(function(e) { | ||
| assert.strictEqual(e.code, 'ENOENT'); | ||
| assert.strictEqual(e.message, `connect ENOENT ${fp}`); | ||
| })); | ||
| c.on('connect', common.mustNotCall()); | ||
| c.on('error', common.mustCall(function(e) { | ||
| assert.strictEqual(e.code, 'ENOENT'); | ||
|
||
| assert.strictEqual(e.message, `connect ENOENT ${fp}`); | ||
| })); | ||
| } | ||
|
|
||
| { | ||
| assert.throws(() => { | ||
| net.createConnection({ path: {} }); | ||
|
||
| }, TypeError); | ||
|
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this to
.connect()instead, under theif (pipe)check?internalConnect()is also called for non-pipe connections and so it would be an unnecessary/redundant check in those cases (since theaddresswould be validated at time oflookup()there).