postgres.git / summary / log / commit / refs

commit    885dfee080743fd1ff70bdbb693475795a23922f
Author:   Peter Eisentraut <peter@eisentraut.org>
Commit:   Noah Misch <noah@leadboat.com>
Date:     Mon Nov 09 14:20:50 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 444fbff0371..b94bda25cf3 100644 --- a/src/bin/pg_basebackup/pg_basebackup.c +++ b/src/bin/pg_basebackup/pg_basebackup.c @@ -1389,8 +1389,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) { @@ -1720,7 +1720,7 @@ ReceiveBackupManifestInMemoryChunk(size_t r, char *copybuf, { PQExpBuffer buf = callback_data; - appendPQExpBuffer(buf, copybuf, r); + appendBinaryPQExpBuffer(buf, copybuf, r); } static void [parent: 0244432c05c1]