From: Igor Shevchenko <igor@carcass.ath.cx>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: PQescapeString handling of \0
Date: Mon, 29 Sep 2003 22:15:20 +0300
Message-ID: <200309292215.20949.igor@carcass.ath.cx> (raw)
In-Reply-To: <27075.1064859721@sss.pgh.pa.us>
References: <200309291949.26188.igor@carcass.ath.cx>
<27075.1064859721@sss.pgh.pa.us>
If the purpose of PQescapeString is to make a safe variant of a given string
(NULL-terminated or counted), where safity means ability to simply add it to
the query (which is char* and is passed directly to PQexec), then either
length should return what strlen would return for the given string or \0
should be escaped somehow.
On Monday 29 September 2003 21:22, Tom Lane wrote:
> Igor Shevchenko <igor@carcass.ath.cx> writes:
> > Here's a patch which makes PQescapeString stop escaping when \0 is seen.
>
> Hm. Is that really the right behavior? Given that the function is
> defined to take a counted string rather than a null-terminated string,
> I'd sort of expect it to turn \0 into "\000" or some such. Of course,
> given that this could overflow the specified size of the return buffer,
> one might simply conclude that the defined API is broken ...
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
--
Best regards,
Igor Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: igor@carcass.ath.cx, tgl@sss.pgh.pa.us
Subject: Re: PQescapeString handling of \0
In-Reply-To: <200309292215.20949.igor@carcass.ath.cx>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox