From: Daniel Gustafsson <dgustafsson@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix sscanf limits in pg_basebackup and pg_dump
Date: Tue, 19 Oct 2021 11:18:54 +0000
Message-ID: <E1mcn8w-0000FN-45@gemulon.postgresql.org> (raw)
Fix sscanf limits in pg_basebackup and pg_dump
Make sure that the string parsing is limited by the size of the
destination buffer.
In pg_basebackup the available values sent from the server
is limited to two characters so there was no risk of overflow.
In pg_dump the buffer is bounded by MAXPGPATH, and thus the limit
must be inserted via preprocessor expansion and the buffer increased
by one to account for the terminator. There is no risk of overflow
here, since in this case, the buffer scanned is smaller than the
destination buffer.
Backpatch the pg_basebackup fix to 11 where it was introduced, and
the pg_dump fix all the way down to 9.6.
Reviewed-by: Tom Lane
Discussion: https://postgr.es/m/B14D3D7B-F98C-4E20-9459-C122C67647FB@yesql.se
Backpatch-through: 11 and 9.6
Branch
------
REL_14_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/121be6a665aaf64e0fe45b424cd26b53b384dc31
Modified Files
--------------
src/bin/pg_basebackup/streamutil.c | 2 +-
src/bin/pg_dump/pg_backup_directory.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
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: dgustafsson@postgresql.org
Subject: Re: pgsql: Fix sscanf limits in pg_basebackup and pg_dump
In-Reply-To: <E1mcn8w-0000FN-45@gemulon.postgresql.org>
References: <E1mcn8w-0000FN-45@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