Re: Crash on attempt to connect to nonstarted server

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Magnus Hagander <magnus@hagander.net>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2010-12-16T15:39:04Z
Lists: pgsql-hackers
Magnus Hagander <magnus@hagander.net> writes:
> I get a crash on win32 when connecting to a server that's not started.
> In fe-connect.c, we have:

> 		display_host_addr = (conn->pghostaddr == NULL) &&
> 			(strcmp(conn->pghost, host_addr) != 0);

> In my case, conn->pghost is NULL at this point, as is
> conn->pghostaddr. Thus, it crashes in strcmp().

[ scratches head... ]  I seem to remember having decided that patch was
OK because what was there before already assumed conn->pghost would be
set.  Under exactly what conditions could we get this far with neither
field being set?

			regards, tom lane