pg.ddx.io  pgpool-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Taiki Koshino <koshino@sraoss.co.jp>
To: pgpool-committers@lists.postgresql.org
Subject: pgpool: Fix operator precedence in parse_wd_node_function_json NodeIdLi
Date: Tue, 29 Sep 2026 04:44:17 +0000
Message-ID: <E1xBPhR-00000002h2D-10gZ@gothos.postgresql.org> (raw)

Fix operator precedence in parse_wd_node_function_json NodeIdList write.

In src/watchdog/wd_json_data.c parse_wd_node_function_json(), the loop
body wrote

    *node_id_set[i] = value->u.array.values[i]->u.integer;

which by C precedence parses as *(node_id_set[i]). node_id_set is an
int ** that aliases the caller's &node_id_list pointer. For i == 0 the
write happens to land on the palloc'd destination buffer; for i >= 1 the
indexing walks sizeof(int*) * i bytes past the int ** parameter into
adjacent memory, dereferences the resulting garbage pointer, and stores
a peer-controlled 32-bit integer there.

Add the missing parentheses so the subscript applies to the dereferenced
array: (*node_id_set)[i] = ...

This is almost certainly the original intent - the single-node
failover path (the common production case) hits only i == 0 and so the
bug has not been observed in normal operation. Any NodeIdList of length
two or more immediately fires the misbehaviour.

Reported-by: Emond Papegaaij <emond.papegaaij@topicus.nl>
Reported-by: Claude
Author: Bo Peng <pengbo@sraoss.co.jp>
CVE-2026-92867
Backpatch-through: v4.3

Branch
------
V4_3_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=3d956ecd7d5823464adcee386971ff0e51c5f...

Modified Files
--------------
src/watchdog/wd_json_data.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1xBPhR-00000002h2D-10gZ@gothos.postgresql.org>
Permalink:  ../E1xBPhR-00000002h2D-10gZ@gothos.postgresql.org/
Also on:    postgresql.org/message-id/E1xBPhR-00000002h2D-10gZ@gothos.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgpool-committers@postgresql.org
  Cc: koshino@sraoss.co.jp
  Subject: Re: pgpool: Fix operator precedence in parse_wd_node_function_json NodeIdLi
  In-Reply-To: <E1xBPhR-00000002h2D-10gZ@gothos.postgresql.org>
  References: <E1xBPhR-00000002h2D-10gZ@gothos.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