postgres.git / summary / log / commit / refs
commit 04986ad59d6167d3ed884a2045b99fca8a9733a8
Author: Peter Eisentraut <peter@eisentraut.org>
Commit: Noah Misch <noah@leadboat.com>
Date: Mon Nov 09 14:20:45 2026 +0000
First released in: 14.25, 15.20, 16.16, 17.12, 18.7, 19.0
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
src/bin/pg_basebackup/pg_basebackup.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c
index 8f3dd04fd22..e78c95bcb78 100644
--- a/src/bin/pg_basebackup/pg_basebackup.c
+++ b/src/bin/pg_basebackup/pg_basebackup.c
@@ -1415,8 +1415,8 @@ ReceiveArchiveStreamChunk(size_t r, char *copybuf, void *callback_data)
if (state->manifest_buffer != NULL)
{
/* Manifest data, buffer in memory. */
- appendPQExpBuffer(state->manifest_buffer, copybuf + 1,
- r - 1);
+ appendBinaryPQExpBuffer(state->manifest_buffer, copybuf + 1,
+ r - 1);
}
else if (state->manifest_file !=NULL)
{
@@ -1746,7 +1746,7 @@ ReceiveBackupManifestInMemoryChunk(size_t r, char *copybuf,
{
PQExpBuffer buf = callback_data;
- appendPQExpBuffer(buf, copybuf, r);
+ appendBinaryPQExpBuffer(buf, copybuf, r);
}
static void
[parent: f3f9bf05b30e]