pgsql: Avoid improbable null pointer dereference in pgpassfileWarning()

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

Avoid improbable null pointer dereference in pgpassfileWarning().

Coverity complained that we might pass a null pointer to strcmp()
if PQresultErrorField were to return NULL. That shouldn't be possible,
since the server is supposed to always provide some SQLSTATE or other
in an error message. But we usually defend against such hazards, and
it only takes a little more code to do so here.

There's no good reason to think this is a live bug, so no back-patch.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/8ac0365c22f20dcd2a6b6752b95b665ada83e858

Modified Files
--------------
src/interfaces/libpq/fe-connect.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers