]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix incorrect message-printing in win32security.c.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 13 Oct 2025 21:56:45 +0000 (17:56 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 13 Oct 2025 21:56:45 +0000 (17:56 -0400)
commitf91666c836dd8915f0ee67a90c5d76e10bfde838
tree0b0d7c3b6e58c5e4829f35bc5de367678b8063a7
parent46086fb6812ffdc15f5277574cc0b5cbc4d81b89
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
src/backend/utils/error/elog.c
src/include/utils/elog.h
src/port/win32security.c