pgsql: Avoid null pointer dereference if error result lacks SQLSTATE.

Started by Tom Laneover 5 years ago1 messagescomitters
Jump to latest
#1Tom Lane
tgl@sss.pgh.pa.us

Avoid null pointer dereference if error result lacks SQLSTATE.

Although error results received from the backend should always have
a SQLSTATE field, ones generated by libpq won't, making this code
vulnerable to a crash after, say, untimely loss of connection.
Noted by Coverity.

Oversight in commit 403a3d91c. Back-patch to 9.5, as that was.

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7d72fd9e6db686c9a499d4238d23525437adc132

Modified Files
--------------
src/bin/pg_dump/pg_backup_db.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)