public inbox for [email protected]  
help / color / mirror / Atom feed
From: Noah Misch <[email protected]>
To: [email protected]
Subject: pgsql: Mark PQfn() unsafe and fix overrun in frontend LO interface.
Date: Mon, 11 May 2026 12:19:39 +0000
Message-ID: <[email protected]> (raw)

Mark PQfn() unsafe and fix overrun in frontend LO interface.

When result_is_int is set to 0, PQfn() cannot validate that the
result fits in result_buf, so it will write data beyond the end of
the buffer when the server returns more data than requested.  Since
this function is insecurable and obsolete, add a warning to the top
of the pertinent documentation advising against its use.

The only in-tree caller of PQfn() is the frontend large object
interface.  To fix that, add a buf_size parameter to
pqFunctionCall3() that is used to protect against overruns, and use
it in a private version of PQfn() that also accepts a buf_size
parameter.

Reported-by: Yu Kunpeng <[email protected]>
Reported-by: Martin Heistermann <[email protected]>
Author: Nathan Bossart <[email protected]>
Reviewed-by: Noah Misch <[email protected]>
Reviewed-by: Tom Lane <[email protected]>
Reviewed-by: Etsuro Fujita <[email protected]>
Security: CVE-2026-6477
Backpatch-through: 14

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/d88c7be156bbde61ccff337152bf640387b2c629
Author: Nathan Bossart <[email protected]>

Modified Files
--------------
doc/src/sgml/libpq.sgml             | 11 ++++++++---
src/interfaces/libpq/fe-exec.c      | 16 +++++++++++++++-
src/interfaces/libpq/fe-lobj.c      | 12 ++++++------
src/interfaces/libpq/fe-protocol3.c | 13 ++++++++++++-
src/interfaces/libpq/libpq-int.h    |  6 +++++-
5 files changed, 46 insertions(+), 12 deletions(-)



reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: pgsql: Mark PQfn() unsafe and fix overrun in frontend LO interface.
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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