From 251033186ff575cf130ec53daa996749022fbad3 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 3 Oct 2003 18:26:14 +0000 Subject: 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. --- doc/src/sgml/libpq.sgml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'doc/src') 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 @@ @@ -1972,10 +1972,13 @@ size_t PQescapeString (char *to, const char *from, size_t length); The parameter from points to the first character of the string -that -is to be escaped, and the length parameter gives the -number of characters in this string. (A terminating zero byte is -neither necessary nor counted.) to shall point to a +that is to be escaped, and the length parameter gives the +number of characters in this string. A terminating zero byte is not +required, and should not be counted in length. (If +a terminating zero byte is found before length bytes are +processed, PQescapeString stops at the zero; the behavior +is thus rather like strncpy.) +to shall point to a buffer that is able to hold at least one more character than twice the value of length, otherwise the behavior is undefined. A call to PQescapeString writes an escaped -- cgit v1.2.3