Re: BUG #16330: psql accesses null pointer in connect.c:do_connect

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, hghwng(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16330: psql accesses null pointer in connect.c:do_connect
Date: 2020-03-30 15:48:51
Message-ID: 20200330154851.GA15986@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2020-Mar-30, Tom Lane wrote:

> Michael Paquier <michael(at)paquier(dot)xyz> writes:
> > On Mon, Mar 30, 2020 at 02:20:48AM +0000, PG Bug reporting form wrote:
> >> If the connection to postmaster is closed, then trying to re-connect to
> >> another one leads to SIGSEGV.
>
> > A fix like the attached should be sufficient as if we know that
> > PQhost() is NULL for the old connection we cannot use the old
> > hostaddr. Alvaro, what do you think?
>
> It looks to me like there's a similar hazard a bit further down
> (line 3029):
>
> appendConnStrVal(&connstr, PQdb(o_conn));
>
> I wonder if we should force reuse_previous to false if there's
> no o_conn, rather than fixing this stuff piecemeal.

That was my impression too.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Dmitry 2020-03-30 20:20:21 Re: BUG #16327: Too many files in pg_replslot folder
Previous Message Tom Lane 2020-03-30 15:35:41 Re: BUG #16330: psql accesses null pointer in connect.c:do_connect