Skip site navigation (1) Skip section navigation (2)

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

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Peter Davie <Peter(dot)Davie(at)relevance(dot)com(dot)au>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1270: stack overflow in thread in fe_getauthname
Date: 2004-09-27 23:39:14
Message-ID: 200409272339.i8RNdE311134@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
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.

This will be in 8.0.  I think it is too risky for 7.4.X but if others
disagree, let me know.

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

PostgreSQL Bugs List wrote:
> 
> The following bug has been logged online:
> 
> Bug reference:      1270
> Logged by:          Peter Davie
> 
> Email address:      Peter(dot)Davie(at)relevance(dot)com(dot)au
> 
> PostgreSQL version: 7.4.5
> 
> Operating system:   OSF/1 4.0f
> 
> Description:        stack overflow in thread in fe_getauthname
> 
> Details: 
> 
> With the THREAD_SAFETY changes, a buffer is defined on the stack as:
> char       pwdbuf[BUFSIZ];
> 
> This buffer overflows the stack when used in a thread.  As the application 
> creating the thread cannot be modified to increase the stack size, it would 
> probably be prudent to reduce this buffer size (I believe that BUFSIZ is 
> around 8192 bytes on most modern Unix implementations). 
> 
> To rectify this issue (seg faults attempting to connect to the database), I 
> replaced the above declaration with: 
> char       pwdbuf[1024];
> Obviously, a manifest constant would be better!
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
> 

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

pgsql-bugs by date

Next:From: Tom LaneDate: 2004-09-27 23:45:54
Subject: Re: BUG #1270: stack overflow in thread in fe_getauthname
Previous:From: PostgreSQL Bugs ListDate: 2004-09-27 23:09:13
Subject: BUG #1270: stack overflow in thread in fe_getauthname

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group