]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Be more paranoid about null return values from libpq status functions.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 25 Nov 2015 22:31:53 +0000 (17:31 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 25 Nov 2015 22:31:53 +0000 (17:31 -0500)
commit64b7079e50cc75fc0e8730793b4a66bfb7388de2
tree50dea01ecb5ed0daa82b8abd4c31a741fe31ac79
parent6638c9aaf881b156fafc05371e8ed21f0cdda66e
Be more paranoid about null return values from libpq status functions.

PQhost() can return NULL in non-error situations, namely when a Unix-socket
connection has been selected by default.  That behavior is a tad debatable
perhaps, but for the moment we should make sure that psql copes with it.
Unfortunately, do_connect() failed to: it could pass a NULL pointer to
strcmp(), resulting in crashes on most platforms.  This was reported as a
security issue by ChenQin of Topsec Security Team, but the consensus of
the security list is that it's just a garden-variety bug with no security
implications.

For paranoia's sake, I made the keep_password test not trust PQuser or
PQport either, even though I believe those will never return NULL given
a valid PGconn.

Back-patch to all supported branches.
src/bin/psql/command.c