From: Jacob Champion <pchampion@vmware.com>
To: tgl@sss.pgh.pa.us <tgl@sss.pgh.pa.us>
Cc: daniel@yesql.se <daniel@yesql.se>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Cc: michael@paquier.xyz <michael@paquier.xyz>
Subject: Re: [PATCH] Make jsonapi usable from libpq
Date: Tue, 29 Jun 2021 19:26:47 +0000
Message-ID: <ea0cdb0974cca85805c6d8131e8eeba0fd811444.camel@vmware.com> (raw)
In-Reply-To: <497374.1624992620@sss.pgh.pa.us>
References: <a250d475ba1c0cc0efb7dfec8e538fcc77cdcb8e.camel@vmware.com>
<YNQedHwheUaTnnGt@paquier.xyz>
<daeb22ec6ca8ef61e94d766a9b35fb03cabed38e.camel@vmware.com>
<YNZ2mnsbDVJQrA/a@paquier.xyz>
<c475057da66fdc5ae707a89f5b44dd8508b86f7e.camel@vmware.com>
<497374.1624992620@sss.pgh.pa.us>
On Tue, 2021-06-29 at 14:50 -0400, Tom Lane wrote:
> Jacob Champion <pchampion@vmware.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: pchampion@vmware.com, tgl@sss.pgh.pa.us, daniel@yesql.se, michael@paquier.xyz
Subject: Re: [PATCH] Make jsonapi usable from libpq
In-Reply-To: <ea0cdb0974cca85805c6d8131e8eeba0fd811444.camel@vmware.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox