summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/dt.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1999-12-09 05:02:24 +0000
committerBruce Momjian <bruce@momjian.us>1999-12-09 05:02:24 +0000
commitd65a27f9509e8cbd0a0d8a58597bd096c2a22207 (patch)
treec84d71172b671d38b944bf3299159120709cc806 /src/backend/utils/adt/dt.c
parent469cf43fac9bd5e261499c2a922f5cb01fbb95f1 (diff)
Hi,
I was able to crash postgres 6.5.3 when I did an 'alter user' command. After I started a debugger I found the problem in the timezone handling of datetime (my Linux box lost its timezone information, that's how the problem occurred). Only 7 bytes are reserved for the timezone, without checking for boundaries. Attached is a patch that fixes this problem and emits a NOTICE if a timezone is encountered that is longer than MAXTZLEN bytes, like this: Jeroen van Vianen
Diffstat (limited to 'src/backend/utils/adt/dt.c')
-rw-r--r--src/backend/utils/adt/dt.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/utils/adt/dt.c b/src/backend/utils/adt/dt.c
index 43da134d97c..1e0b0475c46 100644
--- a/src/backend/utils/adt/dt.c
+++ b/src/backend/utils/adt/dt.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.76 1999/07/17 20:17:55 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.77 1999/12/09 05:02:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -4327,7 +4327,7 @@ EncodeDateTime(struct tm * tm, double fsec, int *tzp, char **tzn, int style, cha
if ((*tzn != NULL) && (tm->tm_isdst >= 0))
{
strcpy((str + 27), " ");
- strcpy((str + 28), *tzn);
+ strncpy((str + 28), *tzn, MAXTZLEN);
}
}
else
@@ -4336,7 +4336,7 @@ EncodeDateTime(struct tm * tm, double fsec, int *tzp, char **tzn, int style, cha
if ((*tzn != NULL) && (tm->tm_isdst >= 0))
{
strcpy((str + 24), " ");
- strcpy((str + 25), *tzn);
+ strncpy((str + 25), *tzn, MAXTZLEN);
}
}