Re: BUG #1270: stack overflow in thread in fe_getauthname

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: Peter Davie <Peter(dot)Davie(at)relevance(dot)com(dot)au>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1270: stack overflow in thread in fe_getauthname
Date: 2004-09-28 00:05:20
Message-ID: 200409280005.i8S05K115885@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Oops. Yep, that is sloppy programming on our part, perhaps my part if I
> > added those. Anyway, patch attached and applied. I used the proper
> > struct sizes instead of BUFSIZ.
>
> You just broke it.
>
> Those buffers are not used to hold struct passwd's, but to hold
> multiple character strings to which the struct passwd will point;
> any one of which could be long, but particularly the home directory
> path.
>
> My man page for getpwuid_r says that the minimum recommended buffer size
> is 1024.
>
> > This will be in 8.0.
>
> I think we should revert it entirely. A small buffer size risks
> breaking things unnecessarily, and as I replied earlier, the request
> to make libpq run in a less-than-8K stack is not reasonable anyway.

Reverted. I forgot about the requirement to store pointers used by the
structure. I knew that when doing the thread patches but forgot about
it.

--
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

Browse pgsql-bugs by date

  From Date Subject
Next Message Mahesh Saravanan 2004-09-28 07:17:27
Previous Message Bruce Momjian 2004-09-27 23:56:27 Re: BUG #1270: stack overflow in thread in fe_getauthname