pgsql: pg_basebackup: Fix use of externally-controlled format string

From: Noah Misch <noah(at)leadboat(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_basebackup: Fix use of externally-controlled format string
Date: 2026-11-09 14:21:47
Message-ID: E1xQQFn-000000003Fn-46Sx@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pg_basebackup: Fix use of externally-controlled format string

appendPQExpBuffer() was accidentally used instead of
appendBinaryPQExpBuffer() in pg_basebackup. The former would
interpret the string to be appended as a format string, which could
lead to misbehavior. (The string contents are related to backup
manifest contents. Those do not normally contain any data that could
look like a format placeholders. In order for this to misbehave,
files with unusual names would have to exist in the data directory.)

- The hunk in ReceiveBackupManifestInMemoryChunk() is from commit
0d8c9c1210c, 2020, PG13. This is only reachable against a pre-PG15
server, because of the next item.

- The hunk in ReceiveArchiveStreamChunk() is from commit cc333f32336,
2022, PG15.

Security: CVE-2026-16240
Backpatch-through: 14

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4a18e9b5f36206584501910c81d0da154f88af54
Author: Peter Eisentraut <peter(at)eisentraut(dot)org>

Modified Files
--------------
src/bin/pg_basebackup/pg_basebackup.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Noah Misch 2026-11-09 14:21:48 pgsql: Fix potential buffer overrun in ts_rank_cd().
Previous Message Daniel Gustafsson 2026-11-09 11:55:11 pgsql: Fix incorrect Unicode code point in SASLprep comment