Subject: pgsql: libpq: Make error checks in the new buffer draining code more ro

From: Heikki Linnakangas <[email-masked]>
Date: Thu, 09 Jul 2026 15:51:22 +0000

libpq: Make error checks in the new buffer draining code more robust

Check explicitly for pqsecure_read() returning an error. It shouldn't
fail, and we would've caught it in the check for a short read, but
better to be explicit so that the error message is more informative.
We also shouldn't update 'inEnd' when the read fails, although that
too is just pro forma as we will bail out and close the connection on
error.

Reported-by: Peter Eisentraut <[email-masked]>
Discussion: https://www.postgresql.org/message-id/[email-masked]
Backpatch-through: 14

Branch
------
REL_19_STABLE

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

Modified Files
--------------
src/interfaces/libpq/fe-misc.c   | 11 ++++++++---
src/interfaces/libpq/fe-secure.c |  5 +++--
2 files changed, 11 insertions(+), 5 deletions(-)