Re: fix for palloc() of user-supplied length

From: Serguei Mokhov <mokhov(at)cs(dot)concordia(dot)ca>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Neil Conway <neilc(at)samurai(dot)com>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: fix for palloc() of user-supplied length
Date: 2002-09-04 22:51:03
Message-ID: 1031179863.3d768e57419cd@mailhost.cs.concordia.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Quoting Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:

> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2002-09-04 22:53:12 Open pg_dump issues
Previous Message Peter Eisentraut 2002-09-04 22:46:39 Re: Multibyte support in oracle_compat.c

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2002-09-04 23:04:32 Re: fix for palloc() of user-supplied length
Previous Message Serguei Mokhov 2002-09-04 22:37:44 Re: fix for palloc() of user-supplied length