Commit 3d357b4
committed
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.1 parent f91c4e3 commit 3d357b4
1 file changed
+13
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1623 | 1623 | | |
1624 | 1624 | | |
1625 | 1625 | | |
1626 | | - | |
1627 | | - | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
1628 | 1629 | | |
1629 | | - | |
1630 | | - | |
1631 | | - | |
1632 | | - | |
1633 | | - | |
1634 | | - | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
1635 | 1638 | | |
1636 | 1639 | | |
1637 | 1640 | | |
| |||
1643 | 1646 | | |
1644 | 1647 | | |
1645 | 1648 | | |
1646 | | - | |
1647 | | - | |
| 1649 | + | |
| 1650 | + | |
1648 | 1651 | | |
1649 | 1652 | | |
1650 | 1653 | | |
| |||
0 commit comments