agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Clean up secure_read()/secure_write() return type
Date: Wed, 15 Jul 2026 06:36:22 +0000
Message-ID: <E1wjtED-000FxW-2i@gemulon.postgresql.org> (raw)

Clean up secure_read()/secure_write() return type

The return type is ssize_t, not int, but some callers didn't handle
this properly.

The BIO callbacks are constrained by the OpenSSL API, so they take int
for the length and return int.  This is safe, since the return value
can't be greater than the input length.  To make it more clear that
this is intentional, cast the result of the
secure_read()/secure_write() call to int explicitly.

Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://www.postgresql.org/message-id/flat/f9aab072-0078-49e4-ab93-3b08086a4406@eisentraut.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7d45a6dc19743d999f5c83c95ad144a0f2eb6745

Modified Files
--------------
src/backend/libpq/be-secure-openssl.c    | 4 ++--
src/backend/libpq/pqcomm.c               | 6 +++---
src/interfaces/libpq/fe-misc.c           | 4 ++--
src/interfaces/libpq/fe-secure-openssl.c | 4 ++--
4 files changed, 9 insertions(+), 9 deletions(-)



Message-ID: <E1wjtED-000FxW-2i@gemulon.postgresql.org>
Permalink:  ../E1wjtED-000FxW-2i@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wjtED-000FxW-2i@gemulon.postgresql.org

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: pgsql-committers@postgresql.org
  Cc: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Clean up secure_read()/secure_write() return type
  In-Reply-To: <E1wjtED-000FxW-2i@gemulon.postgresql.org>

* 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