pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Reject CR and LF characters in backup labels
Date: Mon, 05 Oct 2026 03:48:13 +0000
Message-ID: <E1xDZgT-00000000Lwn-00DE@gemulon.postgresql.org> (raw)

Reject CR and LF characters in backup labels

The label is written as one line of the backup_label file.  A label
with a newline added extra lines to the file, and recovery could read
those as other fields, failing on them.  Characters could also be
injected to make recovery behave in inconsistent ways.

Trying to use such characters in label names is now rejected, for both
pg_backup_start() and BASE_BACKUP.

As this is arguably a behavior change, no backpatch is done.  I also
seriously doubt that anybody is relying on the behavior of pushing some
arbitrary data to backup_label files, and even if they do, it would be a
very bad idea to contradict what the backend decides to generate.

Reported-by: Shallow <theshallow27@gmail.com>
Author: Shihao Zhong <zhong950419@gmail.com>
Discussion: https://postgr.es/m/19730-85a6044c9e72774a@postgresql.org

Branch
------
master

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

Modified Files
--------------
src/backend/access/transam/xlog.c         |  5 +++++
src/test/recovery/t/020_archive_status.pl | 13 +++++++++++++
2 files changed, 18 insertions(+)



Message-ID: <E1xDZgT-00000000Lwn-00DE@gemulon.postgresql.org>
Permalink:  ../E1xDZgT-00000000Lwn-00DE@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xDZgT-00000000Lwn-00DE@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: michael@paquier.xyz
  Subject: Re: pgsql: Reject CR and LF characters in backup labels
  In-Reply-To: <E1xDZgT-00000000Lwn-00DE@gemulon.postgresql.org>
  References: <E1xDZgT-00000000Lwn-00DE@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