Re: initdb segfaulting.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rudy Lippan <rlippan(at)remotelinux(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: initdb segfaulting.
Date: 2002-12-12 19:20:46
Message-ID: 26856.1039720846@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Rudy Lippan <rlippan(at)remotelinux(dot)com> writes:
> Just thought to play with this a bit more and:
> TZ="AAAAAAAAAAAAAAAAAAAAAAAAAA" ../pgsql7.3/bin/initdb <-- segfault
> TZ="AAAAAAAAAAAAAAAAAAAAAAAAA" ../pgsql7.3/bin/initdb <-- initdb failed
> TZ="AAAAAAAAAAAAAAAAAAAAAAAA" ../pgsql7.3/bin/initdb <-- works.

> Looks like a simple buffer overrun.

Yeah, I think so. I cannot replicate a problem here, but that may just
be a matter of how the linker chose to lay out static variables in my
build. Please apply the attached patch against 7.3 and see if it fixes
things for you.

regards, tom lane

*** src/backend/utils/adt/nabstime.c.orig Mon Nov 11 19:39:36 2002
--- src/backend/utils/adt/nabstime.c Thu Dec 12 14:17:04 2002
***************
*** 130,143 ****
* XXX FreeBSD man pages indicate that this should work - thomas
* 1998-12-12
*/
! strcpy(CTZName, tm->tm_zone);

#elif defined(HAVE_INT_TIMEZONE)
tm = localtime(&now);

CDayLight = tm->tm_isdst;
CTimeZone = ((tm->tm_isdst > 0) ? (TIMEZONE_GLOBAL - 3600) : TIMEZONE_GLOBAL);
! strcpy(CTZName, tzname[tm->tm_isdst]);
#else /* neither HAVE_TM_ZONE nor
* HAVE_INT_TIMEZONE */
CTimeZone = tb.timezone * 60;
--- 130,143 ----
* XXX FreeBSD man pages indicate that this should work - thomas
* 1998-12-12
*/
! StrNCpy(CTZName, tm->tm_zone, MAXTZLEN+1);

#elif defined(HAVE_INT_TIMEZONE)
tm = localtime(&now);

CDayLight = tm->tm_isdst;
CTimeZone = ((tm->tm_isdst > 0) ? (TIMEZONE_GLOBAL - 3600) : TIMEZONE_GLOBAL);
! StrNCpy(CTZName, tzname[tm->tm_isdst], MAXTZLEN+1);
#else /* neither HAVE_TM_ZONE nor
* HAVE_INT_TIMEZONE */
CTimeZone = tb.timezone * 60;
***************
*** 212,225 ****
* XXX FreeBSD man pages indicate that this should work - thomas
* 1998-12-12
*/
! strcpy(CTZName, tm->tm_zone);

#elif defined(HAVE_INT_TIMEZONE)
tm = localtime(&now);

CDayLight = tm->tm_isdst;
CTimeZone = ((tm->tm_isdst > 0) ? (TIMEZONE_GLOBAL - 3600) : TIMEZONE_GLOBAL);
! strcpy(CTZName, tzname[tm->tm_isdst]);
#else /* neither HAVE_TM_ZONE nor
* HAVE_INT_TIMEZONE */
CTimeZone = tb.timezone * 60;
--- 212,225 ----
* XXX FreeBSD man pages indicate that this should work - thomas
* 1998-12-12
*/
! StrNCpy(CTZName, tm->tm_zone, MAXTZLEN+1);

#elif defined(HAVE_INT_TIMEZONE)
tm = localtime(&now);

CDayLight = tm->tm_isdst;
CTimeZone = ((tm->tm_isdst > 0) ? (TIMEZONE_GLOBAL - 3600) : TIMEZONE_GLOBAL);
! StrNCpy(CTZName, tzname[tm->tm_isdst], MAXTZLEN+1);
#else /* neither HAVE_TM_ZONE nor
* HAVE_INT_TIMEZONE */
CTimeZone = tb.timezone * 60;

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2002-12-12 21:49:30 Re: ecpg Oracle compatibility issue
Previous Message Rudy Lippan 2002-12-12 18:13:18 postmaster segfaults when pg_hba.cof is missing