ecpg: Fix NULL pointer dereference during connection lookup

ECPGconnect() caches established connections to the server, supporting
the case of a NULL connection name when a database name is not specified
by its caller.

A follow-up call to ECPGget_PGconn() to get an established connection
from the cached set with a non-NULL name could cause a NULL pointer
dereference if a NULL connection was listed in the cache and checked for
a match.  At least two connections are necessary to reproduce the issue:
one with a NULL name and one with a non-NULL name.

Author:  Aleksander Alekseev <aleksan...@tigerdata.com>
Discussion: 
https://postgr.es/m/caj7c6tnvftputzqunaoqgzasgz-im4xr61d7vej5psqxwg2...@mail.gmail.com
Backpatch-through: 13

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0123922f82d2b5349917ecbd4ec197ee6acfa388

Modified Files
--------------
src/interfaces/ecpg/ecpglib/connect.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

Reply via email to