aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Hagander <magnus@hagander.net>2009-01-09 14:07:00 +0000
committerMagnus Hagander <magnus@hagander.net>2009-01-09 14:07:00 +0000
commit8d320b63567d4d40dd9f8018182910f77b41b212 (patch)
tree7abc18cb1e96c309604daa8ec49dfceb97221b4f
parentf8e5b79368f1cc628991fbe1463b15a64fbed8b7 (diff)
downloadpostgresql-8d320b63567d4d40dd9f8018182910f77b41b212.tar.gz
postgresql-8d320b63567d4d40dd9f8018182910f77b41b212.zip
Code review of strftime patch, per comments from Tom:
* Use correct buffer size MAX_L10N_DATA * Use strlcpy instead of StrNCpy
-rw-r--r--src/backend/utils/adt/pg_locale.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c
index 95ce7fd40c7..1d35a506627 100644
--- a/src/backend/utils/adt/pg_locale.c
+++ b/src/backend/utils/adt/pg_locale.c
@@ -4,7 +4,7 @@
*
* Portions Copyright (c) 2002-2009, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/backend/utils/adt/pg_locale.c,v 1.44 2009/01/09 13:03:55 mha Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/pg_locale.c,v 1.45 2009/01/09 14:07:00 mha Exp $
*
*-----------------------------------------------------------------------
*/
@@ -476,7 +476,7 @@ strftime_win32(char *dst, size_t dstlen, const wchar_t *format, const struct tm
encoding = GetDatabaseEncoding();
- len = wcsftime(wbuf, sizeof(wbuf), format, tm);
+ len = wcsftime(wbuf, MAX_L10N_DATA, format, tm);
if (len == 0)
/* strftime call failed - return 0 with the contents of dst unspecified */
return 0;
@@ -492,7 +492,7 @@ strftime_win32(char *dst, size_t dstlen, const wchar_t *format, const struct tm
char *convstr = pg_do_encoding_conversion(dst, len, PG_UTF8, encoding);
if (dst != convstr)
{
- StrNCpy(dst, convstr, dstlen);
+ strlcpy(dst, convstr, dstlen);
len = strlen(dst);
}
}