Re: fix for palloc() of user-supplied length - Mailing list pgsql-patches

From Serguei Mokhov
Subject Re: fix for palloc() of user-supplied length
Date
Msg-id 1031179863.3d768e57419cd@mailhost.cs.concordia.ca
Whole thread Raw
In response to Re: fix for palloc() of user-supplied length  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Quoting Tom Lane <tgl@sss.pgh.pa.us>:

> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > I wish there was an easier way to fix this, but it seems you have done
> > the research and this is what is required.
>
> This is awfully messy.  There's got to be a cleaner way of divvying up
> this code...

Just to clarify a bit on my solution in case my English didn't get through
properly the first time...

I simply provided two versions of pq_getstr - pq_getstr() with the same
behaviour as before (read until input isn't over by \0) and pq_getstr_bounded()
that reads up to a certain limit or till \0. Functions needed split, IMNSHO,
because grep of the source gave more invocations of pq_getstr, which I was
afaraid to break, so that's why two functions.

I can justify the rest as well, if you wish. If you are positive, be the change
in one function only it would not break anything, then the cleaner solution is
just to change that one function - pg_gestring() invoked directly by
pg_getstr().

-s

--
Serguei A. Mokhov, <mailto: mokhov @ cs.concordia.ca>
Computer Science, Concordia University

-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/

pgsql-patches by date:

Previous
From: Serguei Mokhov
Date:
Subject: Re: fix for palloc() of user-supplied length
Next
From: Tom Lane
Date:
Subject: Re: fix for palloc() of user-supplied length