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

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


Would someone submit a patch for this?

---------------------------------------------------------------------------

Tom Lane wrote:
> Neil Conway <neilc(at)samurai(dot)com> writes:
> > (2) The length supplied by the user is completely ignored by
> > the code, and it simply reads the input until it sees a
> > NULL terminator (read the comments in the code about 10
> > lines down.) Therefore, any sanity checking on the length
> > specified by the user is a waste of time.
>
> Agreed; the fact that the protocol requires a length word at all is just
> a hangover from the past. We can read the length word and forget it.
>
> I wonder though if it'd be worthwhile to limit the length of the string
> that we are willing to read from the client in the second step. We are
> at this point dealing with an unauthenticated user, so we should be
> untrusting. And I think Sir Mordred has a point: forcing a backend to
> allocate a lot of memory can be a form of DoS attack.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-09-02 05:18:50 Re: Impending freeze
Previous Message Christopher Kings-Lynne 2002-09-02 04:57:47 tsearch stop words

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2002-09-02 05:07:29 Re: update to contrib/dblink
Previous Message Bruce Momjian 2002-09-02 04:41:51 Re: failed to build libpq.so on AIX 4 and 5/I have a solution