pgpool2.git / summary / log / commit / refs
commit 0954931dc1ded3ede906e847267bc19fa6f75c5b
Author: Taiki Koshino <koshino@sraoss.co.jp>
Date: Sun Sep 20 03:37:43 2026 +0000
Reject short heartbeat datagrams in heartbeat receiver.
wd_hb_recv() called recvfrom() into a stack-local WdHbPacket and only
rejected negative or zero-length results. A datagram shorter than
sizeof(WdHbPacket) leaves the buffer partially initialised, so the
subsequent ntoh_wd_hb_packet() (strcmp/snprintf on pkt->from, pkt->hash,
etc.) reads uninitialised stack bytes. That is undefined behaviour and
can leak stack contents into the pgpool log.
Treat any datagram smaller than the full packet as an error, matching
the existing zero-length idiom (ereport(ERROR) longjmps out of the
receiver loop).
Reported-by: Emond Papegaaij <emond.papegaaij@topicus.nl>
Reported-by: Claude
Author: Tatsuo Ishii <ishii@postgresql.org>
CVE-2026-92872
Backpatch-through: v4.3
src/watchdog/wd_heartbeat.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/watchdog/wd_heartbeat.c b/src/watchdog/wd_heartbeat.c
index f83b612c4..a6598cd16 100644
--- a/src/watchdog/wd_heartbeat.c
+++ b/src/watchdog/wd_heartbeat.c
@@ -496,6 +496,10 @@ wd_hb_recv(int sock, WdHbPacket *pkt, char *from_addr)
else if (rtn == 0)
ereport(ERROR,
(errmsg("failed to receive heartbeat received zero length packet")));
+ else if (rtn < (int) sizeof(WdHbPacket))
+ ereport(ERROR,
+ (errmsg("wd_hb_recv: short heartbeat datagram (%d bytes, expected %zu)",
+ rtn, sizeof(WdHbPacket))));
else
ereport(DEBUG2,
(errmsg("watchdog heartbeat: received %d byte packet", rtn)));
[parent: c0a31c45e751]