summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/datetime.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-05-29 19:16:57 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-05-29 19:16:57 +0000
commit22a517a40c29ec421db8ebd8b1eb17e50b76b406 (patch)
tree10b00ec5ab4eaa84efe85e0072711b80d0414b1a /src/backend/utils/adt/datetime.c
parentf089c36419adcfc23b3a83560dc67633b1e7b939 (diff)
Repair problems with overrun of timezone name length. Increase MAXTZLEN
to 10, and be consistent about whether it counts the trailing null (it does not). Also increase MAXDATELEN to be sure no buffer overflows are caused by the longer MAXTZLEN.
Diffstat (limited to 'src/backend/utils/adt/datetime.c')
-rw-r--r--src/backend/utils/adt/datetime.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index f252a42ddc5..aa45b0ed512 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.47 2000/04/14 15:22:10 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.48 2000/05/29 19:16:57 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2153,7 +2153,7 @@ EncodeDateTime(struct tm * tm, double fsec, int *tzp, char **tzn, int style, cha
if ((*tzn != NULL) && (tm->tm_isdst >= 0))
{
strcpy((str + 27), " ");
- strncpy((str + 28), *tzn, MAXTZLEN);
+ StrNCpy((str + 28), *tzn, MAXTZLEN+1);
}
}
else
@@ -2162,7 +2162,7 @@ EncodeDateTime(struct tm * tm, double fsec, int *tzp, char **tzn, int style, cha
if ((*tzn != NULL) && (tm->tm_isdst >= 0))
{
strcpy((str + 24), " ");
- strncpy((str + 25), *tzn, MAXTZLEN);
+ StrNCpy((str + 25), *tzn, MAXTZLEN+1);
}
}