Hi Diego,
Thanks for v2!
> * The returned allocation contains a plaintext password.
> PQfreemem() does not erase it, whereas libpq explicitly clears
> passwords stored in PGconn before freeing them. It would be useful
> for the documentation to mention that callers are responsible for
> securely clearing the result where appropriate.
The new docs now say this, but passwordFromFile() leaves part of the
original password after removing escapes in place:
Password in .pgpass: pa\\ss\:word
Returned buffer: pa\ss:word\0d\0
A caller using explicit_bzero(password, strlen(password)) before
PQfreemem() leaves the final 'd' untouched. Could we zero this tail in
passwordFromFile() before returning? The caller does not know the
original allocation size.
Best regards,
Denis Smirnov