pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix incorrect message-printing in win32security.c.
Date: Mon, 13 Oct 2025 21:57:04 +0000
Message-ID: <E1v8QXQ-001YBi-23@gemulon.postgresql.org> (raw)

Fix incorrect message-printing in win32security.c.

log_error() would probably fail completely if used, and would
certainly print garbage for anything that needed to be interpolated
into the message, because it was failing to use the correct printing
subroutine for a va_list argument.

This bug likely went undetected because the error cases this code
is used for are rarely exercised - they only occur when Windows
security API calls fail catastrophically (out of memory, security
subsystem corruption, etc).

The FRONTEND variant can be fixed just by calling vfprintf()
instead of fprintf().  However, there was no va_list variant
of write_stderr(), so create one by refactoring that function.
Following the usual naming convention for such things, call
it vwrite_stderr().

Author: Bryan Green <dbryan.green@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAF+pBj8goe4fRmZ0V3Cs6eyWzYLvK+HvFLYEYWG=TzaM+tWPnw@mail.gmail.com
Backpatch-through: 13

Branch
------
REL_14_STABLE

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

Modified Files
--------------
src/backend/utils/error/elog.c | 16 +++++++++++++---
src/include/utils/elog.h       |  1 +
src/port/win32security.c       |  4 ++--
3 files changed, 16 insertions(+), 5 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1v8QXQ-001YBi-23@gemulon.postgresql.org>
Permalink:  ../E1v8QXQ-001YBi-23@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1v8QXQ-001YBi-23@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: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix incorrect message-printing in win32security.c.
  In-Reply-To: <E1v8QXQ-001YBi-23@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 DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox