diff options
author | Tom Lane | 2025-07-02 19:47:59 +0000 |
---|---|---|
committer | Tom Lane | 2025-07-02 19:48:02 +0000 |
commit | fe05430ace8e0b3c945cf581564458a5983a07b6 (patch) | |
tree | fa65f646f5115339564ac2826eafb57ca5cb3b31 | |
parent | 0c2b7174c362d3092eb7eabf0117a8d47c64ce0e (diff) |
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 <[email protected]>
Author: Sergei Kornilov <[email protected]>
Reviewed-by: Tom Lane <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 17
-rw-r--r-- | src/interfaces/libpq/fe-cancel.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/interfaces/libpq/fe-cancel.c b/src/interfaces/libpq/fe-cancel.c index cd3102346bf..65517c5703b 100644 --- a/src/interfaces/libpq/fe-cancel.c +++ b/src/interfaces/libpq/fe-cancel.c @@ -137,6 +137,7 @@ PQcancelCreate(PGconn *conn) goto oom_error; originalHost = conn->connhost[conn->whichhost]; + cancelConn->connhost[0].type = originalHost.type; if (originalHost.host) { cancelConn->connhost[0].host = strdup(originalHost.host); |