[openssl/openssl] 608aca: pem: fix a memory leak in PEM_write_bio_PrivateKey...

Milan Broz noreply at github.com
Thu Nov 10 17:13:06 UTC 2022


  Branch: refs/heads/master
  Home:   https://github.com/openssl/openssl
  Commit: 608aca8ed2becccfe9c238846834ea2b162fc98b
      https://github.com/openssl/openssl/commit/608aca8ed2becccfe9c238846834ea2b162fc98b
  Author: Milan Broz <gmazyland at gmail.com>
  Date:   2022-11-10 (Thu, 10 Nov 2022)

  Changed paths:
    M crypto/pem/pem_pkey.c

  Log Message:
  -----------
  pem: fix a memory leak in PEM_write_bio_PrivateKey_traditional

The copy of PKEY should be released on the error path.
Easily reproduced with "ED448" context.

Signed-off-by: Milan Broz <gmazyland at gmail.com>

Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19536)


  Commit: 373d90128042cb0409e347827d80b50a99d3965a
      https://github.com/openssl/openssl/commit/373d90128042cb0409e347827d80b50a99d3965a
  Author: Milan Broz <gmazyland at gmail.com>
  Date:   2022-11-10 (Thu, 10 Nov 2022)

  Changed paths:
    M crypto/pem/pem_pkey.c
    M test/evp_pkey_provided_test.c

  Log Message:
  -----------
  pem: avoid segfault if PKEY is NULL in PEM_write_bio_PrivateKey

Make the code more robust and correctly handle EVP_PKEY set to NULL
instead of dereferencing null pointer.

Signed-off-by: Milan Broz <gmazyland at gmail.com>

Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19536)


Compare: https://github.com/openssl/openssl/compare/4378e3cd2a4d...373d90128042


More information about the openssl-commits mailing list