This patch makes PQescapeString() guard against null input
ptrs and/or length == 0 input. If any of these occur, the
function returns 0.