Re: [PATCH] Make jsonapi usable from libpq - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCH] Make jsonapi usable from libpq
Date
Msg-id 497374.1624992620@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCH] Make jsonapi usable from libpq  (Jacob Champion <pchampion@vmware.com>)
Responses Re: [PATCH] Make jsonapi usable from libpq
List pgsql-hackers
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?

            regards, tom lane



pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: PG 14 release notes, first draft
Next
From: Jacob Champion
Date:
Subject: Re: [PATCH] Make jsonapi usable from libpq