| From: | Michael Paquier <michael(at)paquier(dot)xyz> |
|---|---|
| To: | Diego <mrstephenamell(at)gmail(dot)com> |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org, Denis Smirnov <darthunix(at)gmail(dot)com>, Grigorev Jurij <ju(dot)grigorev(at)ftdata(dot)ru>, Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com> |
| Subject: | Re: [PATCH] libpq: Add PQpassfileLookup() |
| Date: | 2026-11-27 05:57:32 |
| Message-ID: | awkbzAyVFNH-LoF6@paquier.xyz |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Thu, Nov 26, 2026 at 08:48:01AM -0800, Diego wrote:
> v3 [1] is two patches:
>
> - 0001 fixes a gap in how libpq clears a password read from the
> password file. passwordFromFile() does strdup() on the rest of the
> line and then de-escapes the password in place, so the tail of an
> escaped password, and any fields after it, are left in the
> allocation past the terminator, out of reach of the
> explicit_bzero(p, strlen(p)) in pqReleaseConnHosts(). It is +21/-9
> in fe-connect.c and does not depend on the new API.
Hmm, yeah, I guess that you are right here and that this leaks useless
data in the stack. One could argue about a backpatch but this is
close to explicit_bzero() in spirit even, so let's do so as an
improvement. I don't see a point in complicating the comment the way
you are suggesting: this explains a non-consequence. Or just simplify
the comment to a simpler "De-escape the buffer, before copying it into
the result.".
I am not planning to spend cycles on your 0002, though. (Perhaps
others will be interested in that.)
> Is there anything I can do to make this easier to pick up? If the API
> needs more discussion, 0001 can go in on its own, and I can move it to
> a separate thread if that helps.
One suggestion: you could help other people. If you are using some
AI-generated content, which I think is at least partially the case, a
second suggestion is to slow down with the noise and the quantity of
text in your messages or patches.
> Michael, I added you in Cc because you reworked the error handling in
> passwordFromFile() last year (861af926103).
For a completely unrelated thing. But thanks anyway. :)
--
Michael
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chao Li | 2026-11-27 06:13:46 | Fix empty and whitespace-only input handling in option_parse_int() |
| Previous Message | Osama Abdul Qader | 2026-11-27 05:54:29 | Re: Fix deparsing of SUBSTRING SIMILAR with an operator as first argument |