tls: copy the Buffer object before using#8055
Closed
thefourtheye wants to merge 2 commits intonodejs:masterfrom
Closed
tls: copy the Buffer object before using#8055thefourtheye wants to merge 2 commits intonodejs:masterfrom
thefourtheye wants to merge 2 commits intonodejs:masterfrom
Conversation
`convertNPNProtocols` uses the `protocols` buffer object as it is, and if it is modified outside of core, it might have an impact. This patch makes a copy of the buffer object, before using it.
Member
|
LGTM. Good catch. |
| if (protocols instanceof Buffer) { | ||
| out.NPNProtocols = protocols; | ||
| // copy new buffer not to be modified by user | ||
| out.NPNProtocols = Buffer.from(protocols); |
Member
There was a problem hiding this comment.
This is inefficient (in a minor way) if protocols was originally an array. In that case two buffers are created, here and in convertProtocols().
Member
|
Take-it-or-leave-it performance comment. LGTM with style nit if you want to land it as-is. |
Member
|
LGTM |
Member
|
Oh, you might want to update the commit log to also mention convertALPNProtocols(). |
Member
|
LGTM |
Member
Member
|
CI is green. Landing |
jasnell
pushed a commit
that referenced
this pull request
Aug 18, 2016
`convertNPNProtocols` and `convertALPNProtocols' uses the `protocols` buffer object as it is, and if it is modified outside of core, it might have an impact. This patch makes a copy of the buffer object, before using it. PR-URL: #8055 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Member
|
Landed in 60dcd73 |
Contributor
Author
|
Thanks @jasnell :-) |
evanlucas
pushed a commit
that referenced
this pull request
Aug 24, 2016
`convertNPNProtocols` and `convertALPNProtocols' uses the `protocols` buffer object as it is, and if it is modified outside of core, it might have an impact. This patch makes a copy of the buffer object, before using it. PR-URL: #8055 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Contributor
|
this is not backporting cleanly. Is it relevant to v4.x? I know there has been a bunch of churn on buffer |
MylesBorins
pushed a commit
to MylesBorins/node
that referenced
this pull request
Oct 11, 2016
`convertNPNProtocols` and `convertALPNProtocols' uses the `protocols` buffer object as it is, and if it is modified outside of core, it might have an impact. This patch makes a copy of the buffer object, before using it. PR-URL: nodejs#8055 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
rvagg
pushed a commit
that referenced
this pull request
Oct 18, 2016
`convertNPNProtocols` and `convertALPNProtocols' uses the `protocols` buffer object as it is, and if it is modified outside of core, it might have an impact. This patch makes a copy of the buffer object, before using it. PR-URL: #8055 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
MylesBorins
pushed a commit
that referenced
this pull request
Oct 26, 2016
`convertNPNProtocols` and `convertALPNProtocols' uses the `protocols` buffer object as it is, and if it is modified outside of core, it might have an impact. This patch makes a copy of the buffer object, before using it. PR-URL: #8055 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Closed
MylesBorins
pushed a commit
that referenced
this pull request
Jan 19, 2017
cherry-pick c26b9af from v6-staging. `convertNPNProtocols` and `convertALPNProtocols' uses the `protocols` buffer object as it is, and if it is modified outside of core, it might have an impact. This patch makes a copy of the buffer object, before using it. PR-URL: #8055 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
MylesBorins
pushed a commit
that referenced
this pull request
Jan 24, 2017
cherry-pick c26b9af from v6-staging. `convertNPNProtocols` and `convertALPNProtocols' uses the `protocols` buffer object as it is, and if it is modified outside of core, it might have an impact. This patch makes a copy of the buffer object, before using it. PR-URL: #8055 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Merged
MylesBorins
pushed a commit
that referenced
this pull request
Feb 1, 2017
cherry-pick c26b9af from v6-staging. `convertNPNProtocols` and `convertALPNProtocols' uses the `protocols` buffer object as it is, and if it is modified outside of core, it might have an impact. This patch makes a copy of the buffer object, before using it. PR-URL: #8055 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
make -j4 test(UNIX), orvcbuild test nosign(Windows) passesAffected core subsystem(s)
tls
Description of change
convertNPNProtocolsuses theprotocolsbuffer object as it is, andif it is modified outside of core, it might have an impact. This patch
makes a copy of the buffer object, before using it.
cc @nodejs/crypto