pgsql: Fix sscanf limits in pg_dump

From: Daniel Gustafsson <dgustafsson(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix sscanf limits in pg_dump
Date: 2021-10-19 11:20:32
Message-ID: E1mcnAW-0000Jb-LJ@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix sscanf limits in pg_dump

Make sure that the string parsing is limited by the size of the
destination buffer.

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 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: 9.6

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6b96aafc67ac80590a8317ec6a0447e95a2b1f66

Modified Files
--------------
src/bin/pg_dump/pg_backup_directory.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2021-10-19 15:35:44 pgsql: Remove bogus assertion in transformExpressionList().
Previous Message Daniel Gustafsson 2021-10-19 11:20:26 pgsql: Fix sscanf limits in pg_dump