Re: 7.4.5 / 7.4.6 crash (pg_hba.conf issue)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: 7.4.5 / 7.4.6 crash (pg_hba.conf issue)
Дата
Msg-id 2862.1100721470@sss.pgh.pa.us
обсуждение исходный текст
Ответ на 7.4.5 / 7.4.6 crash (pg_hba.conf issue)  (Rod Taylor <pg@rbt.ca>)
Ответы Re: 7.4.5 / 7.4.6 crash (pg_hba.conf issue)  (Devrim GUNDUZ <devrim@gunduz.org>)
Список pgsql-hackers
Rod Taylor <pg@rbt.ca> writes:
> I've run across a bug in pg_hba.conf routines which is repeatable in
> both 32bit intel on Linux and 64bit AMD on FreeBSD with both 7.4.5 and
> 7.4.6. It results in the postmaster crashing which is quite annoying
> when it leaves behind it's children.

Off-by-one memory allocation problem --- it only bites you if the string
lengths are just right, which probably explains the lack of prior
reports even though the bug has been there since 7.3.  Simplest fix is

Index: hba.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/libpq/hba.c,v
retrieving revision 1.87.2.4
retrieving revision 1.87.2.5
diff -c -r1.87.2.4 -r1.87.2.5
*** hba.c    13 Apr 2003 04:07:31 -0000    1.87.2.4
--- hba.c    17 Nov 2004 19:54:53 -0000    1.87.2.5
***************
*** 281,287 ****         {             if (strlen(comma_str))             {
!                 comma_str = repalloc(comma_str, strlen(comma_str) + 1);                 strcat(comma_str,
MULTI_VALUE_SEP);            }             comma_str = repalloc(comma_str,
 
--- 281,287 ----         {             if (strlen(comma_str))             {
!                 comma_str = repalloc(comma_str, strlen(comma_str) + 1 + 1);                 strcat(comma_str,
MULTI_VALUE_SEP);            }             comma_str = repalloc(comma_str,
 

        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: Tired of -Wold-style-definition already
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Tired of -Wold-style-definition already