It seems the buffer created in pset_quoted_string is just 1 char too small.
This breaks psql's \pset for me, though I've no idea why the buildfarm is not complaining a bit more. As it stands, if the function is given an empty string to quote, it tries to build a string with 2 single quotes and a NUL. This needs 3 chars, not 2. The attached simple patch fixes the problem.
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index cb94ce3..26089352 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -2711,7 +2711,7 @@ pset_bool_string(bool val) static char * pset_quoted_string(const char *str) { - char *ret = pg_malloc(strlen(str) * 2 + 2); + char *ret = pg_malloc(strlen(str) * 2 + 3); char *r = ret; *r++ = '\'';
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers