pgsql: Avoid null pointer dereference if error result lacks SQLSTATE. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Avoid null pointer dereference if error result lacks SQLSTATE.
Date
Msg-id E1kZGCL-0001PE-QU@gemulon.postgresql.org
Whole thread Raw
List 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
------
master

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

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


pgsql-committers by date:

Previous
From: Michael Paquier
Date:
Subject: pgsql: Preserve index data in pg_statistic across REINDEX CONCURRENTLY
Next
From: Tom Lane
Date:
Subject: pgsql: Fix two issues in TOAST decompression.