git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a0bf885)
Guard against overrunning CTZName buffer when TZ is bogus.
2002年12月12日 19:16:55 +0000 (19:16 +0000)
2002年12月12日 19:16:55 +0000 (19:16 +0000)

diff --git a/src/backend/utils/adt/nabstime.c b/src/backend/utils/adt/nabstime.c
index a6aa8a42b3bceadc00ef208366f7d375fc3dddbb..853cd014852d3692076360cc7ba56a8a25128d47 100644 (file)
--- a/src/backend/utils/adt/nabstime.c
+++ b/src/backend/utils/adt/nabstime.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.101 2002年11月12日 00:39:08 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.102 2002年12月12日 19:16:55 tgl Exp $
*
* NOTES
*
@@ -130,14 +130,14 @@ GetCurrentAbsoluteTime(void)
* XXX FreeBSD man pages indicate that this should work - thomas
* 1998年12月12日
*/
- strcpy(CTZName, tm->tm_zone);
+ 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);
- strcpy(CTZName, tzname[tm->tm_isdst]);
+ StrNCpy(CTZName, tzname[tm->tm_isdst], MAXTZLEN+1);
#else /* neither HAVE_TM_ZONE nor
* HAVE_INT_TIMEZONE */
CTimeZone = tb.timezone * 60;
@@ -212,14 +212,14 @@ GetCurrentAbsoluteTimeUsec(int *usec)
* XXX FreeBSD man pages indicate that this should work - thomas
* 1998年12月12日
*/
- strcpy(CTZName, tm->tm_zone);
+ 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);
- strcpy(CTZName, tzname[tm->tm_isdst]);
+ StrNCpy(CTZName, tzname[tm->tm_isdst], MAXTZLEN+1);
#else /* neither HAVE_TM_ZONE nor
* HAVE_INT_TIMEZONE */
CTimeZone = tb.timezone * 60;
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /