-
Notifications
You must be signed in to change notification settings - Fork 30k
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
tls_wrap: slice buffer properly in ClearOut
#4184
Conversation
Fix incorrect slicing of cleartext buffer in `TLSWrap::ClearOut`. Fix: nodejs#4161
cc @nodejs/crypto |
CI is green |
@@ -60,7 +62,7 @@ a.listen(common.PORT, function() { | |||
}); | |||
ssl.setEncoding('utf8'); | |||
ssl.once('data', function(data) { | |||
assert.equal('hello', data); | |||
assert.equal(body.toString(), data); |
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.
Is it safe to assume the entire body will always come in one data
event?
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.
Argh, of course no.
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.
Fixed, thanks!
LGTM |
Landed in c0cb80e, thank you! |
Fix incorrect slicing of cleartext buffer in `TLSWrap::ClearOut`. Fix: #4161 PR-URL: #4184 Reviewed-By: Brian White <[email protected]>
ssl.once('data', function(data) { | ||
assert.equal('hello', data); | ||
buf += data; | ||
gotHello = true; | ||
}); |
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.
Shouldn't it be on
?
Also, is gotHello
really necessary?
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.
Arghh... It should be on
indeed. @santigimeno would it be interesting to you to submit a PR with a fix for this?
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.
gotHello
seems to be necessary, but could be replaced with common.mustCall
in ssl.on('end', ...)
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.
I said about gotHello
because would the test exit if no end
event was received?
Yes, I can send a PR.
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.
Thank you, @santigimeno . Please don't forget to cc me on that PR ;)
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.
Fix incorrect slicing of cleartext buffer in `TLSWrap::ClearOut`. Fix: #4161 PR-URL: #4184 Reviewed-By: Brian White <[email protected]>
Fix incorrect slicing of cleartext buffer in `TLSWrap::ClearOut`. Fix: #4161 PR-URL: #4184 Reviewed-By: Brian White <[email protected]>
Fix incorrect slicing of cleartext buffer in `TLSWrap::ClearOut`. Fix: #4161 PR-URL: #4184 Reviewed-By: Brian White <[email protected]>
Fix incorrect slicing of cleartext buffer in `TLSWrap::ClearOut`. Fix: nodejs#4161 PR-URL: nodejs#4184 Reviewed-By: Brian White <[email protected]>
Fix incorrect slicing of cleartext buffer in
TLSWrap::ClearOut
.Fix: #4161