Re: BUG #7811: strlen(NULL) cause psql crash

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: 1584171677(at)qq(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #7811: strlen(NULL) cause psql crash
Date: 2013-01-15 18:10:56
Message-ID: 29141.1358273456@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> writes:
> That'd change the behavior of all sprintf calls, not sure we want to go
> there.

I don't think so; especially since the proposed fix doesn't help on
systems where we are using the native printf.

> I committed a local fix to help.c to print "none" as the database name
> when not connected.

I think that patch could use more thought. As is, it will print

connect to new database (currently "none")

which to me is claiming that we are connected to a database whose name
is "none". The quotes should not be used in this situation, and in
fact it would be better for translatability if the whole message text
were specialized to this case. I'd like to see it reading more like

connect to new database (currently no connection)

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Heikki Linnakangas 2013-01-15 18:17:20 Re: BUG #7811: strlen(NULL) cause psql crash
Previous Message Heikki Linnakangas 2013-01-15 17:29:08 Re: BUG #7811: strlen(NULL) cause psql crash