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.