pgsql: Avoid potential pfree on NULL on OpenSSL errors - Mailing list pgsql-committers

From Daniel Gustafsson
Subject pgsql: Avoid potential pfree on NULL on OpenSSL errors
Date
Msg-id [email protected]
Whole thread Raw
List pgsql-committers
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 <[email protected]>
Discussion: https://postgr.es/m/[email protected]
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(-)


pgsql-committers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: pgsql: Avoid potential pfree on NULL on OpenSSL errors
Next
From: Daniel Gustafsson
Date:
Subject: pgsql: Avoid using internal test methods in SSL tests