pgsql: Repair unsafe/unportable snprintf usage in pg_restore.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Repair unsafe/unportable snprintf usage in pg_restore.
Date: 2019-02-10 00:45:58
Message-ID: E1gsdFu-0006BA-FE@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Repair unsafe/unportable snprintf usage in pg_restore.

warn_or_exit_horribly() was blithely passing a potentially-NULL
string pointer to a %s format specifier. That works (at least
to the extent of not crashing) on some platforms, but not all,
and since we switched to our own snprintf.c it doesn't work
for us anywhere.

Of the three string fields being handled this way here, I think
that only "owner" is supposed to be nullable ... but considering
that this is error-reporting code, it has very little business
assuming anything, so put in defenses for all three.

Per a crash observed on buildfarm member crake and then
reproduced here. Because of the portability aspect,
back-patch to all supported versions.

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2b6009e2a2794df286939e5ce1196a23cca07d68

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

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2019-02-10 02:02:26 pgsql: Solve cross-version-upgrade testing problem induced by 1fb57af92
Previous Message Tom Lane 2019-02-09 23:32:29 pgsql: Build out the planner support function infrastructure.