Skip to content
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

Fix invalid malloc failures in PEM_write_bio_PKCS8PrivateKey*() #75

Conversation

RaisinTen
Copy link

This cherry-picks my fix from openssl#17507, so that I can make use of it in Node.js where we use this fork instead of the main openssl repo for QUIC support.

cc @tmshort

Checklist
  • documentation is added or updated
  • tests are added or updated

When `PEM_write_bio_PKCS8PrivateKey()` was passed an empty passphrase
string, `OPENSSL_memdup()` was incorrectly getting used for 0 bytes size
allocation, which resulted in malloc failures.

Fixes: openssl#17506

Signed-off-by: Darshan Sen <raisinten@gmail.com>

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from openssl#17507)
Signed-off-by: Darshan Sen <raisinten@gmail.com>

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from openssl#17507)
@tmshort
Copy link
Member

tmshort commented Mar 15, 2022

If this is in the upstream openssl-3.0 branch, it will be in the the openssl-3.0.2+quic branch today.

@RaisinTen
Copy link
Author

Yes indeed, thanks for the updated. Closing since the required change is already present.

@RaisinTen RaisinTen closed this Mar 16, 2022
@RaisinTen RaisinTen deleted the fix-invalid-malloc-failures branch March 16, 2022 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants