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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Avoid null pointer dereference if error result lacks SQLSTATE.
Date: 2020-11-01 16:27:17
Message-ID: E1kZGCL-0001PU-Su@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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
------
REL9_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/29ae4cd82949843d09aa02a8125a5b5087201431

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

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2020-11-01 23:38:53 pgsql: Fix two issues in TOAST decompression.
Previous Message Michael Paquier 2020-11-01 12:26:01 pgsql: Preserve index data in pg_statistic across REINDEX CONCURRENTLY