pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Álvaro Herrera <alvherre@kurilemu.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix dereference in a couple of GUC check hooks
Date: Tue, 24 Mar 2026 15:49:08 +0000
Message-ID: <E1w540B-001FxS-0s@gemulon.postgresql.org> (raw)

Fix dereference in a couple of GUC check hooks

check_backtrace_functions() and check_archive_directory() were doing an
empty-string check this way:
    *newval[0] == '\0'
which, because of operator precedence, is interpreted as *(newval[0])
instead of (*newval)[0] -- but these variables are pointers to C-strings
and we want to check the first character therein, rather than check the
first pointer of the array, so that interpretation is wrong.  This would
be wrong for any index element other than 0, as evidenced by every other
dereference of the same variable in check_backtrace_functions, which use
parentheses.

Add parentheses to make the intended dereference explicit.

This is just cosmetic at this stage, so no backpatch, although it's been
"wrong" for a long time.

Author: Zhang Hu <kongbaik228@gmail.com>
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>
Reviewed-by: Chao Li <lic@highgo.com>
Discussion: https://postgr.es/m/CAB5m2QssN6UO+ckr6ZCcV0A71mKUB6WdiTw1nHo43v4DTW1Dfg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5f2350a043db08ab0ea48d22f51acfa5d9b374d9

Modified Files
--------------
contrib/basic_archive/basic_archive.c | 2 +-
src/backend/utils/error/elog.c        | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)



Message-ID: <E1w540B-001FxS-0s@gemulon.postgresql.org>
Permalink:  ../E1w540B-001FxS-0s@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1w540B-001FxS-0s@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: alvherre@kurilemu.de, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix dereference in a couple of GUC check hooks
  In-Reply-To: <E1w540B-001FxS-0s@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