mirror of
https://github.com/postgres/postgres.git
synced 2026-04-21 06:08:26 -04:00
Fix null pointer dereference in "\c" psql command.
The psql crash happened when no current connection existed. (The second new check is optional given today's undocumented NULL argument handling in PQhost() etc.) Back-patch to 9.0 (all supported versions).
This commit is contained in:
parent
7a858f7bf4
commit
6087bf1a19
1 changed files with 2 additions and 1 deletions
|
|
@ -1260,7 +1260,8 @@ do_connect(char *dbname, char *user, char *host, char *port)
|
|||
* syntax.
|
||||
*/
|
||||
keep_password =
|
||||
((strcmp(user, PQuser(o_conn)) == 0) &&
|
||||
(o_conn &&
|
||||
(strcmp(user, PQuser(o_conn)) == 0) &&
|
||||
(!host || strcmp(host, PQhost(o_conn)) == 0) &&
|
||||
(strcmp(port, PQport(o_conn)) == 0) &&
|
||||
!has_connection_string);
|
||||
|
|
|
|||
Loading…
Reference in a new issue