I have found a small but annoying bug in libpq where
connection parameters are resolved via LDAP.
There is a write past the end of a malloc'ed string which causes
memory corruption. The code and the bug are originally by me :^(
The attached patch fixes the problem in HEAD.
This should be backpatched to 8.2 where the code was introduced.
Yours,
Laurenz Albe