Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitff73496

Browse files
committed
Guard against overrunning CTZName buffer when TZ is bogus.
1 parenta0bf885 commitff73496

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎src/backend/utils/adt/nabstime.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.101 2002/11/1200:39:08 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.102 2002/12/1219:16:55 tgl Exp $
1313
*
1414
* NOTES
1515
*
@@ -130,14 +130,14 @@ GetCurrentAbsoluteTime(void)
130130
* XXX FreeBSD man pages indicate that this should work - thomas
131131
* 1998-12-12
132132
*/
133-
strcpy(CTZName,tm->tm_zone);
133+
StrNCpy(CTZName,tm->tm_zone,MAXTZLEN+1);
134134

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

138138
CDayLight=tm->tm_isdst;
139139
CTimeZone= ((tm->tm_isdst>0) ? (TIMEZONE_GLOBAL-3600) :TIMEZONE_GLOBAL);
140-
strcpy(CTZName,tzname[tm->tm_isdst]);
140+
StrNCpy(CTZName,tzname[tm->tm_isdst],MAXTZLEN+1);
141141
#else/* neither HAVE_TM_ZONE nor
142142
* HAVE_INT_TIMEZONE */
143143
CTimeZone=tb.timezone*60;
@@ -212,14 +212,14 @@ GetCurrentAbsoluteTimeUsec(int *usec)
212212
* XXX FreeBSD man pages indicate that this should work - thomas
213213
* 1998-12-12
214214
*/
215-
strcpy(CTZName,tm->tm_zone);
215+
StrNCpy(CTZName,tm->tm_zone,MAXTZLEN+1);
216216

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

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp