BUG #16330: psql accesses null pointer in connect.c:do_connect
The Post Office <noreply@postgresql.org>
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: hghwng@gmail.com
Date: 2020-03-30T02:20:48Z
Lists: pgsql-bugs
The following bug has been logged on the website: Bug reference: 16330 Logged by: Hugh Wang Email address: hghwng@gmail.com PostgreSQL version: 12.2 Operating system: Arch Linux Description: If the connection to postmaster is closed, then trying to re-connect to another one leads to SIGSEGV. REPRODUCE: $ psql -> \conninfo You are connected to database "hugh" as user "hugh" via socket in "/run/postgresql" at port "5432". *shut down server with commands like "systemctl stop postgresql"* -> \conninfo You are currently not connected to a database. -> \c a b c d [1] 984978 segmentation fault (core dumped) psql ANALYSIS: PQhost(o_conn) returns NULL, and strcmp(host, NULL) raises SIGSEGV. SOURCE: https://github.com/postgres/postgres/blob/master/src/bin/psql/command.c#L3016
Commits
-
Fix crash in psql when attempting to reuse old connection
- f79bea4b6bcd 12.3 landed
- 8d84dd001239 13.0 landed
-
psql: Show IP address in \conninfo
- 6e5f8d489acc 12.0 cited