Skip to content

Commit feae7c3

Browse files
committed
Don't pass NULL to fprintf, if a bogus connection string is given to pg_dump.
Back-patch to all supported branches.
1 parent 04d7fa5 commit feae7c3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/bin/pg_dump/pg_backup_db.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,8 @@ ConnectDatabase(Archive *AHX,
305305
/* check to see that the backend connection was successfully made */
306306
if (PQstatus(AH->connection) == CONNECTION_BAD)
307307
die_horribly(AH, modulename, "connection to database \"%s\" failed: %s",
308-
PQdb(AH->connection), PQerrorMessage(AH->connection));
308+
PQdb(AH->connection) ? PQdb(AH->connection) : "",
309+
PQerrorMessage(AH->connection));
309310

310311
/* check for version mismatch */
311312
_check_database_version(AH);

0 commit comments

Comments
 (0)