Rudy Lippan <[EMAIL PROTECTED]> 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;

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to