crypto: pass empty passphrases to OpenSSL properly#35914
Closed
tniessen wants to merge 1 commit intonodejs:masterfrom
Closed
crypto: pass empty passphrases to OpenSSL properly#35914tniessen wants to merge 1 commit intonodejs:masterfrom
tniessen wants to merge 1 commit intonodejs:masterfrom
Conversation
Collaborator
|
Review requested:
|
addaleax
approved these changes
Nov 1, 2020
75b73df to
17654c6
Compare
fhinkel
approved these changes
Nov 2, 2020
jasnell
approved these changes
Nov 2, 2020
cjihrig
approved these changes
Nov 2, 2020
Trott
approved these changes
Nov 2, 2020
17654c6 to
6c6a42d
Compare
6c6a42d to
6e328e4
Compare
Collaborator
Collaborator
tniessen
added a commit
that referenced
this pull request
Nov 4, 2020
Fixes: #35898 PR-URL: #35914 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Member
Author
|
Landed in 9aafda5, thank you for reviewing! |
targos
pushed a commit
that referenced
this pull request
Nov 4, 2020
Fixes: #35898 PR-URL: #35914 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
bnoordhuis
reviewed
Apr 20, 2022
| // intentionally use a pointer that will likely cause a segmentation fault | ||
| // when dereferenced. | ||
| CHECK_EQ(pass_len, 0); | ||
| pass = reinterpret_cast<char*>(-1); |
Member
There was a problem hiding this comment.
Somewhat belatedly... forging pointers is technically UB and can lead to miscompiles, even if the pointer is never dereferenced. I get why it's doing what it's doing but I would suggest to just set pass = "";
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.
This solves two related problems:
PrivateKeyEncodingConfigwas unable to distinguish between "no passphrase" and zero-length passphrases, since both may be stored asByteSource(nullptr, 0).nullptrfor the passphrase. However, this did happen when an empty passphrase was specified, becausemalloc(0)is allowed to return anullptr.I'm not sure why these problems don't affect older versions.
Fixes: #35898
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes