Re: PQescapeString handling of \0 - Mailing list pgsql-interfaces

From Tom Lane
Subject Re: PQescapeString handling of \0
Date
Msg-id 19872.1065195062@sss.pgh.pa.us
Whole thread Raw
In response to Re: PQescapeString handling of \0  (greg@turnstep.com)
Responses Re: PQescapeString handling of \0  ("Jeroen T. Vermeulen" <jtv@xs4all.nl>)
List pgsql-interfaces
greg@turnstep.com writes:
> Tom Lane wrote:
>>> Hm.  Is that really the right behavior?

> Has we reached a consensus on this? I'd like to have DBD::Pg and
> PQescapeString consistent. Right now, we (DBD::Pg) are leaning toward
> the "bail if we hit \0" theory, but it would be nice to have something
> definitive in the API.

Ugly as it is, I think that we have little choice but to go with the
behavior Igor proposes (stop at \0).  If we do the other then we will
have to raise the required size of the output buffer, which will
silently break existing apps (possibly creating security holes, even).
So essentially PQescapeString is going to become like strncpy --- stop
at either \0 or the given count.

This patch hasn't been applied as of 7.4b4 but I'll try to get it in
shortly.
        regards, tom lane


pgsql-interfaces by date:

Previous
From: greg@turnstep.com
Date:
Subject: Re: PQescapeString handling of \0
Next
From: "Jeroen T. Vermeulen"
Date:
Subject: Re: PQescapeString handling of \0