Content-Length: 321025 | pFad | http://github.com/postgrespro/postgres_cluster/commit/ff7349694f399d0063b51419ea6e25770334f363

6C Guard against overrunning CTZName buffer when TZ is bogus. · postgrespro/postgres_cluster@ff73496 · GitHub
Skip to content

Commit ff73496

Browse files
committed
Guard against overrunning CTZName buffer when TZ is bogus.
1 parent a0bf885 commit ff73496

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/12 00:39:08 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.102 2002/12/12 19: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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/ff7349694f399d0063b51419ea6e25770334f363

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy