| From: | Taiki Koshino <koshino(at)sraoss(dot)co(dot)jp> |
|---|---|
| To: | pgpool-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgpool: Reject node count larger than MAX_NUM_BACKENDS in parse_wd_node |
| Date: | 2026-09-29 04:43:57 |
| Message-ID: | E1xBPh7-00000002gpL-3cTn@gothos.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgpool-committers |
Reject node count larger than MAX_NUM_BACKENDS in parse_wd_node_function_json.
parse_wd_node_function_json() in src/watchdog/wd_json_data.c parses a
peer-supplied NodeCount and a NodeIdList array out of a watchdog JSON
message and palloc()s an int array of node_count entries to populate.
The downstream consumer degenerate_backend_set_ex() in
src/main/pool_internal_comms.c declares
int node_id[MAX_NUM_BACKENDS];
(128 ints, 512 bytes) on the stack and copies up to node_count entries
into it. A peer that sets NodeCount above MAX_NUM_BACKENDS therefore
writes past the stack buffer in the failover-command path, which is
reachable from WD_IPC_FAILOVER_COMMAND and wd_authkey is not set.
Bound node_count at the parser, before the palloc, so an out-of-range
value is rejected via ereport(ERROR) and never reaches the downstream
fixed-size stack array.
Reported-by: Emond Papegaaij <emond(dot)papegaaij(at)topicus(dot)nl>
Reported-by: Claude
Author: Tatsuo Ishii <ishii(at)postgresql(dot)org>
CVE-2026-92870
Backpatch-through: v4.3
Branch
------
V4_4_STABLE
Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=2dd04af2e7d312a1e0508a9776f08777b415f78d
Modified Files
--------------
src/watchdog/wd_json_data.c | 7 +++++++
1 file changed, 7 insertions(+)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Taiki Koshino | 2026-09-29 04:44:17 | pgpool: NULL-check json_get_value_for_key inputs and outputs in watchdo |
| Previous Message | Taiki Koshino | 2026-09-29 04:43:39 | pgpool: Add parse_peer_count helper and bound backend_desc array parsin |