From: Tatsuo Ishii <ishii@postgresql.org>
To: pgpool-committers@lists.postgresql.org
Subject: pgpool: Fix lifecheck buffer overrun.
Date: Thu, 01 Oct 2026 11:16:51 +0000
Message-ID: <E1xCEmR-0000000Bzbh-2R1E@gothos.postgresql.org> (raw)
Fix lifecheck buffer overrun.
load_watchdog_nodes_from_json() in wd_lifecheck.c used strcpy() to
copy WDNodeInfo.stateName to lifeCheckNode.stateName. As the size of
WDNodeInfo.stateName is WD_MAX_HOST_NAMELEN (254), while the size of
lifeCheckNode.stateName was 128, theoretically it was possible for the
strcpy() to overrun lifeCheckNode.stateName. Fortunately strings used
for WDNodeInfo.stateName are predefined as global variable
(wd_state_names in watchdog.c), and never exceeds 128 bytes at this
point. But bug is a bug.
To fix this, change the size of LifeCheckNode.stateName from 128 to
WD_MAX_HOST_NAMELEN, which aligns with WDNodeInfo.stateName.
In passing following changes are made:
- Eliminate use of strcpy() in load_watchdog_nodes_from_json(),
instead use strlcpy().
- Fix the size of WDNodeInfo.nodeName which was mistakenly defined as
WD_MAX_HOST_NAMELEN. Correct one is WD_MAX_NODE_NAMELEN.
Author: Tatsuo Ishii <ishii@sraoss.co.jp>
Backpatch-through: v4.3
Branch
------
master
Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=a76292e80f388dea26893cc63eb270a6be901...
Modified Files
--------------
src/include/watchdog/wd_commands.h | 2 +-
src/include/watchdog/wd_lifecheck.h | 2 +-
src/watchdog/wd_lifecheck.c | 9 ++++++---
3 files changed, 8 insertions(+), 5 deletions(-)
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: ishii@postgresql.org
Subject: Re: pgpool: Fix lifecheck buffer overrun.
In-Reply-To: <E1xCEmR-0000000Bzbh-2R1E@gothos.postgresql.org>
References: <E1xCEmR-0000000Bzbh-2R1E@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