pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <fujii@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Use pg_parse_lsn() for IDENTIFY_SYSTEM responses in libpqwalrece
Date: Thu, 22 Oct 2026 07:46:53 +0000
Message-ID: <E1xJnVl-00000000IcI-1GZR@gemulon.postgresql.org> (raw)

Use pg_parse_lsn() for IDENTIFY_SYSTEM responses in libpqwalreceiver

libpqwalreceiver parses the WAL flush location returned by
IDENTIFY_SYSTEM using sscanf("%X/%X") into uint32 values. This
accepts overlong components and trailing characters, potentially
producing a different LSN from the one supplied by the upstream server.

Use pg_parse_lsn() instead, requiring one to eight hexadecimal digits
per component and no trailing characters, as for pg_lsn input. Reject
malformed locations with the existing protocol violation error.

Suggested-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Jan Nidzwetzki <jan@planetscale.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/tencent_C6ED19DF1759CDD37E786F7EE0B5207D0009@qq.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ba6d9ee259cdb2a6c862a4741b16194106e00a9a

Modified Files
--------------
src/backend/replication/libpqwalreceiver/libpqwalreceiver.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)



Message-ID: <E1xJnVl-00000000IcI-1GZR@gemulon.postgresql.org>
Permalink:  ../E1xJnVl-00000000IcI-1GZR@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xJnVl-00000000IcI-1GZR@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 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: pgsql-committers@postgresql.org
  Cc: fujii@postgresql.org
  Subject: Re: pgsql: Use pg_parse_lsn() for IDENTIFY_SYSTEM responses in libpqwalrece
  In-Reply-To: <E1xJnVl-00000000IcI-1GZR@gemulon.postgresql.org>
  References: <E1xJnVl-00000000IcI-1GZR@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