*** ./dt.c.orig Wed Dec 8 17:18:16 1999 --- ./dt.c Wed Dec 8 17:23:32 1999 *************** *** 4327,4333 **** if ((*tzn != NULL) && (tm->tm_isdst >= 0)) { strcpy((str + 27), " "); ! strcpy((str + 28), *tzn); } } else --- 4327,4333 ---- if ((*tzn != NULL) && (tm->tm_isdst >= 0)) { strcpy((str + 27), " "); ! strncpy((str + 28), *tzn, MAXTZLEN); } } else *************** *** 4336,4342 **** if ((*tzn != NULL) && (tm->tm_isdst >= 0)) { strcpy((str + 24), " "); ! strcpy((str + 25), *tzn); } } --- 4336,4342 ---- if ((*tzn != NULL) && (tm->tm_isdst >= 0)) { strcpy((str + 24), " "); ! strncpy((str + 25), *tzn, MAXTZLEN); } } *** ./nabstime.c.orig Wed Dec 8 16:45:06 1999 --- ./nabstime.c Wed Dec 8 17:33:29 1999 *************** *** 174,180 **** *tzp = -tm->tm_gmtoff; /* tm_gmtoff is Sun/DEC-ism */ /* XXX FreeBSD man pages indicate that this should work - tgl 97/04/23 */ if (tzn != NULL) ! strcpy(tzn, tm->tm_zone); #elif defined(HAVE_INT_TIMEZONE) if (tzp != NULL) #ifdef __CYGWIN__ --- 174,189 ---- *tzp = -tm->tm_gmtoff; /* tm_gmtoff is Sun/DEC-ism */ /* XXX FreeBSD man pages indicate that this should work - tgl 97/04/23 */ if (tzn != NULL) ! { ! /* Copy no more than MAXTZLEN bytes of timezone to tzn, in case it ! contains an error message, which doesn't fit in the buffer */ ! strncpy(tzn, tm->tm_zone, MAXTZLEN); ! if (strlen(tm->tm_zone) > MAXTZLEN) ! { ! tzn[MAXTZLEN] = '\0'; ! elog(NOTICE, "Invalid timezone \'%s\'", tm->tm_zone); ! } ! } #elif defined(HAVE_INT_TIMEZONE) if (tzp != NULL) #ifdef __CYGWIN__ *************** *** 183,189 **** *tzp = (tm->tm_isdst ? (timezone - 3600) : timezone); #endif if (tzn != NULL) ! strcpy(tzn, tzname[tm->tm_isdst]); #else #error POSIX time support is broken #endif --- 192,207 ---- *tzp = (tm->tm_isdst ? (timezone - 3600) : timezone); #endif if (tzn != NULL) ! { ! /* Copy no more than MAXTZLEN bytes of timezone to tzn, in case it ! contains an error message, which doesn't fit in the buffer */ ! strncpy(tzn, tzname[tm->tm_isdst], MAXTZLEN); ! if (strlen(tzname[tm->tm_isdst]) > MAXTZLEN) ! { ! tzn[MAXTZLEN] = '\0'; ! elog(NOTICE, "Invalid timezone \'%s\'", tzname[tm->tm_isdst]); ! } ! } #else #error POSIX time support is broken #endif