pgsql: Correctly copy the target host identification in PQcancelCreate.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Correctly copy the target host identification in PQcancelCreate.
Date: 2025-07-02 19:48:15
Message-ID: E1uX3RH-004OvM-2c@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Correctly copy the target host identification in PQcancelCreate.

PQcancelCreate failed to copy struct pg_conn_host's "type" field,
instead leaving it zero (a/k/a CHT_HOST_NAME). This seemingly
has no great ill effects if it should have been CHT_UNIX_SOCKET
instead, but if it should have been CHT_HOST_ADDRESS then a
null-pointer dereference will occur when the cancelConn is used.

Bug: #18974
Reported-by: Maxim Boguk <maxim(dot)boguk(at)gmail(dot)com>
Author: Sergei Kornilov <sk(at)zsrv(dot)org>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/18974-575f02b2168b36b3@postgresql.org
Backpatch-through: 17

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5d0800000ed5e4fb5ed010bb4b93f966e08b9fb3

Modified Files
--------------
src/interfaces/libpq/fe-cancel.c | 1 +
1 file changed, 1 insertion(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2025-07-02 23:42:11 pgsql: Add InjectionPointList() to retrieve list of injection points
Previous Message Nathan Bossart 2025-07-02 19:44:42 Re: pgsql: Fix cross-version upgrade test breakage from commit fe07100e82.