pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Igor Shevchenko <igor@carcass.ath.cx>
To: pgsql-interfaces@postgresql.org
Subject: PQescapeString handling of \0
Date: Mon, 29 Sep 2003 19:49:26 +0300
Message-ID: <200309291949.26188.igor@carcass.ath.cx> (raw)

Hi.

Here's a patch which makes PQescapeString stop escaping when \0 is seen.
Currently. if somebody passes a string with embedded \0 (for example, perl 
allows \0s in it's scalars and DBD::Pg does no checks), PQescapeString will 
return an invalid (bigger) length for \0-terminated string.

-- 
Best regards,
Igor Shevchenko

Attachments:

  [text/x-diff] fe-exec_pqescapestring.diff (296B, ../200309291949.26188.igor@carcass.ath.cx/2-fe-exec_pqescapestring.diff)
  download | inline diff:
--- postgresql-7.4beta3/src/interfaces/libpq/fe-exec.c	2003-09-05 05:08:36.000000000 +0300
+++ psql/src/interfaces/libpq/fe-exec.c	2003-09-29 19:40:06.481977880 +0300
@@ -2179,2 +2179,6 @@ PQescapeString(char *to, const char *fro
 				break;
+				
+			case 0:
+				remaining = 0;
+				continue;
 

view thread (9+ messages)  latest in thread

Message-ID: <200309291949.26188.igor@carcass.ath.cx>
Permalink:  ../200309291949.26188.igor@carcass.ath.cx/
Also on:    postgresql.org/message-id/200309291949.26188.igor@carcass.ath.cx

 ·  · 

reply

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
  Subject: Re: PQescapeString handling of \0
  In-Reply-To: <200309291949.26188.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