Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

Fix invalid malloc failures in PEM_write_bio_PKCS8PrivateKey*()#75

Closed
RaisinTen wants to merge 2 commits into
quictls:openssl-3.0.1+quicfrom
RaisinTen:fix-invalid-malloc-failures
Closed

Fix invalid malloc failures in PEM_write_bio_PKCS8PrivateKey*()#75
RaisinTen wants to merge 2 commits into
quictls:openssl-3.0.1+quicfrom
RaisinTen:fix-invalid-malloc-failures

Conversation

@RaisinTen
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants