X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id E070DD1B553 for ; Fri, 3 Oct 2003 15:33:31 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 75441-06 for ; Fri, 3 Oct 2003 12:32:46 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id AFF70D1B58D for ; Fri, 3 Oct 2003 12:31:02 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h93FV2hn019873; Fri, 3 Oct 2003 11:31:02 -0400 (EDT) To: greg@turnstep.com Cc: pgsql-interfaces@postgresql.org Subject: Re: PQescapeString handling of \0 In-reply-to: References: Comments: In-reply-to greg@turnstep.com message dated "Fri, 03 Oct 2003 13:37:34 -0000" Date: Fri, 03 Oct 2003 11:31:02 -0400 Message-ID: <19872.1065195062@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/2 X-Sequence-Number: 4491 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