aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-10-03 18:26:14 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-10-03 18:26:14 +0000
commit251033186ff575cf130ec53daa996749022fbad3 (patch)
treeba5c4f571541863bea9cd8164ba3cfe40fbedbb8 /doc/src
parent3b4c142030de5e016cb7b87a0bbcb070aab997cd (diff)
downloadpostgresql-251033186ff575cf130ec53daa996749022fbad3.tar.gz
postgresql-251033186ff575cf130ec53daa996749022fbad3.zip
Cause PQescapeString to stop processing at a null character, rather
than generating an invalid output string. Per observation and patch from Igor Shevchenko. Further code cleanup and documentation by Tom Lane.
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/libpq.sgml13
1 files changed, 8 insertions, 5 deletions
diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml
index cd2a8f491ff..37e1fffb5fe 100644
--- a/doc/src/sgml/libpq.sgml
+++ b/doc/src/sgml/libpq.sgml
@@ -1,5 +1,5 @@
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.137 2003/09/20 20:12:05 tgl Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.138 2003/10/03 18:26:14 tgl Exp $
-->
<chapter id="libpq">
@@ -1972,10 +1972,13 @@ size_t PQescapeString (char *to, const char *from, size_t length);
<para>
The parameter <parameter>from</> points to the first character of the string
-that
-is to be escaped, and the <parameter>length</> parameter gives the
-number of characters in this string. (A terminating zero byte is
-neither necessary nor counted.) <parameter>to</> shall point to a
+that is to be escaped, and the <parameter>length</> parameter gives the
+number of characters in this string. A terminating zero byte is not
+required, and should not be counted in <parameter>length</>. (If
+a terminating zero byte is found before <parameter>length</> bytes are
+processed, <function>PQescapeString</> stops at the zero; the behavior
+is thus rather like <function>strncpy</>.)
+<parameter>to</> shall point to a
buffer that is able to hold at least one more character than twice
the value of <parameter>length</>, otherwise the behavior is
undefined. A call to <function>PQescapeString</> writes an escaped