pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Repair unsafe/unportable snprintf usage in pg_restore.
Date: Sun, 10 Feb 2019 00:45:58 +0000
Message-ID: <E1gsdFu-0006BD-G8@gemulon.postgresql.org> (raw)

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_4_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ed46d0d322b54b618557b88948c72bc2711d7c1b

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



view thread (6+ messages)  latest in thread

Message-ID: <E1gsdFu-0006BD-G8@gemulon.postgresql.org>
Permalink:  ../E1gsdFu-0006BD-G8@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1gsdFu-0006BD-G8@gemulon.postgresql.org

 · 

reply

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: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Repair unsafe/unportable snprintf usage in pg_restore.
  In-Reply-To: <E1gsdFu-0006BD-G8@gemulon.postgresql.org>
  References: <E1gsdFu-0006BD-G8@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