BUG #1270: stack overflow in thread in fe_getauthname - Mailing list pgsql-bugs

From PostgreSQL Bugs List
Subject BUG #1270: stack overflow in thread in fe_getauthname
Date
Msg-id 20040927230913.A5CB75A1039@www.postgresql.com
Whole thread Raw
Responses Re: BUG #1270: stack overflow in thread in fe_getauthname
Re: BUG #1270: stack overflow in thread in fe_getauthname
List pgsql-bugs
The following bug has been logged online:

Bug reference:      1270
Logged by:          Peter Davie

Email address:      Peter.Davie@relevance.com.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!

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Dollar quoting inside a regex bracket expression
Next
From: Bruce Momjian
Date:
Subject: Re: BUG #1270: stack overflow in thread in fe_getauthname