pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Gustafsson <dgustafsson@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid potential pfree on NULL on OpenSSL errors
Date: Fri, 22 Sep 2023 09:27:20 +0000
Message-ID: <E1qjcRT-005HZ4-TE@gemulon.postgresql.org> (raw)

Avoid potential pfree on NULL on OpenSSL errors

Guard against the pointer being NULL before pfreeing upon an error
returned from OpenSSL.  Also handle errors from X509_NAME_print_ex
which also can return -1 on memory allocation errors.

Backpatch down to v15 where the code was added.

Author: Sergey Shinderuk <s.shinderuk@postgrespro.ru>
Discussion: https://postgr.es/m/8db5374d-32e0-6abb-d402-40762511eff2@postgrespro.ru
Backpatch-through: v15

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9dc85806d8beb1d4b0cc5461cc3a7d2e44c6e782

Modified Files
--------------
src/backend/libpq/be-secure-openssl.c | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)



view thread (3+ messages)

Message-ID: <E1qjcRT-005HZ4-TE@gemulon.postgresql.org>
Permalink:  ../E1qjcRT-005HZ4-TE@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qjcRT-005HZ4-TE@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: dgustafsson@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Avoid potential pfree on NULL on OpenSSL errors
  In-Reply-To: <E1qjcRT-005HZ4-TE@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox