pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: libpq: Be strict about cancel key lengths
2+ messages / 1 participants
[nested] [flat]

* pgsql: libpq: Be strict about cancel key lengths
@ 2025-08-22 11:45  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 2+ messages in thread

From: Heikki Linnakangas @ 2025-08-22 11:45 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

libpq: Be strict about cancel key lengths

The protocol documentation states that the maximum length of a cancel
key is 256 bytes. This starts checking for that limit in libpq.
Otherwise third party backend implementations will probably start
using more bytes anyway. We also start requiring that a protocol 3.0
connection does not send a longer cancel key, to make sure that
servers don't start breaking old 3.0-only clients by accident. Finally
this also restricts the minimum key length to 4 bytes (both in the
protocol spec and in the libpq implementation).

Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Jacob Champion <jchampion@postgresql.org>
Discussion: https://www.postgresql.org/message-id/df892f9f-5923-4046-9d6f-8c48d8980b50@iki.fi
Backpatch-through: 18

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e411a8d25a4b39e5a896f765ca91636057e261fc

Modified Files
--------------
doc/src/sgml/protocol.sgml          |  2 +-
src/interfaces/libpq/fe-protocol3.c | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: libpq: Be strict about cancel key lengths
@ 2025-08-22 11:45  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 2+ messages in thread

From: Heikki Linnakangas @ 2025-08-22 11:45 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

libpq: Be strict about cancel key lengths

The protocol documentation states that the maximum length of a cancel
key is 256 bytes. This starts checking for that limit in libpq.
Otherwise third party backend implementations will probably start
using more bytes anyway. We also start requiring that a protocol 3.0
connection does not send a longer cancel key, to make sure that
servers don't start breaking old 3.0-only clients by accident. Finally
this also restricts the minimum key length to 4 bytes (both in the
protocol spec and in the libpq implementation).

Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Jacob Champion <jchampion@postgresql.org>
Discussion: https://www.postgresql.org/message-id/df892f9f-5923-4046-9d6f-8c48d8980b50@iki.fi
Backpatch-through: 18

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e7ff96853ea78fd5fc00987fac276a35c265b1bf

Modified Files
--------------
doc/src/sgml/protocol.sgml          |  2 +-
src/interfaces/libpq/fe-protocol3.c | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-08-22 11:45 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-08-22 11:45 pgsql: libpq: Be strict about cancel key lengths Heikki Linnakangas <heikki.linnakangas@iki.fi>
2025-08-22 11:45 pgsql: libpq: Be strict about cancel key lengths Heikki Linnakangas <heikki.linnakangas@iki.fi>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox