From: | Jacob Champion <pchampion(at)vmware(dot)com> |
---|---|
To: | "tgl(at)sss(dot)pgh(dot)pa(dot)us" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "daniel(at)yesql(dot)se" <daniel(at)yesql(dot)se>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, "michael(at)paquier(dot)xyz" <michael(at)paquier(dot)xyz> |
Subject: | Re: [PATCH] Make jsonapi usable from libpq |
Date: | 2021-06-29 19:26:47 |
Message-ID: | ea0cdb0974cca85805c6d8131e8eeba0fd811444.camel@vmware.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, 2021-06-29 at 14:50 -0400, Tom Lane wrote:
> Jacob Champion <pchampion(at)vmware(dot)com> writes:
> > What would you think about a src/port of asprintf()? Maybe libpq
> > doesn't change quickly enough to worry about it, but having developers
> > revisit stack allocation for strings every time they target the libpq
> > parts of the code seems like a recipe for security problems.
>
> The existing convention is to use pqexpbuffer.c, which seems strictly
> cleaner and more robust than asprintf. In particular its behavior under
> OOM conditions is far easier/safer to work with. Maybe we should consider
> moving that into src/common/ so that it can be used by code that's not
> tightly bound into libpq?
I will take a look. Were you thinking we'd (hypothetically) migrate all
string allocation code under src/common to pqexpbuffer as part of that
move? Or just have it there to use as needed, when nm complains?
--Jacob
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2021-06-29 19:34:29 | Re: [PATCH] Make jsonapi usable from libpq |
Previous Message | Tom Lane | 2021-06-29 18:50:20 | Re: [PATCH] Make jsonapi usable from libpq |