]> git.ipfire.org Git - thirdparty/postgresql.git/commit
ecpg: Fix NULL pointer dereference during connection lookup
authorMichael Paquier <michael@paquier.xyz>
Tue, 22 Jul 2025 05:00:04 +0000 (14:00 +0900)
committerMichael Paquier <michael@paquier.xyz>
Tue, 22 Jul 2025 05:00:04 +0000 (14:00 +0900)
commit0ded7615d8cafbb1a5ae3d0ba0a931eb146e63a5
tree256af9f45f03b6b605900ada4748fcf9fd8ce1b0
parentf9545e95c5e7ead0c19676ef8c966eb21f573954
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 <aleksander@tigerdata.com>
Discussion: https://postgr.es/m/CAJ7c6TNvFTPUTZQuNAoqgzaSGz-iM4XR61D7vEj5PsQXwg2RyA@mail.gmail.com
Backpatch-through: 13
src/interfaces/ecpg/ecpglib/connect.c