Re: [patch] fix dblink security hole - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [patch] fix dblink security hole
Date
Msg-id 21818.1222048801@sss.pgh.pa.us
Whole thread Raw
In response to Re: [patch] fix dblink security hole  (Joe Conway <mail@joeconway.com>)
Responses Re: [patch] fix dblink security hole  (Joe Conway <mail@joeconway.com>)
List pgsql-hackers
Joe Conway <mail@joeconway.com> writes:
> Tom Lane wrote:
>> Uh, you're confusing the backend environment with libpq's much more
>> spartan lifestyle.  errmsg will be malloc'd and it will *not* go away
>> unless the caller free()s it.

> Yup, just figured that out. Otherwise OK with it?

Yeah.  We could make one further refinement: callers that don't care
about acquiring an error string can pass NULL for the errmsg parameter.
That tells PQconninfoParse to throw away the errmsg string anyway.
With that, the minimal case isn't much uglier than your original:
just need a NULL arg tacked onto the call.

BTW, the usual method for doing this is just to give the caller back the
errorBuf.data, not incur an additional strdup that could fail.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Joe Conway
Date:
Subject: Re: [patch] fix dblink security hole
Next
From: Stephen Frost
Date:
Subject: Re: Proposal: move column defaults into pg_attribute along with attacl