From 9abf629ce0a84864481c24269a25785719b93a91 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Fri, 9 Jan 2009 14:07:00 +0000 Subject: [PATCH] Code review of strftime patch, per comments from Tom: * Use correct buffer size MAX_L10N_DATA * Use strlcpy instead of StrNCpy --- src/backend/utils/adt/pg_locale.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c index 769a6d5cbc..b8f553fbf7 100644 --- a/src/backend/utils/adt/pg_locale.c +++ b/src/backend/utils/adt/pg_locale.c @@ -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); } } -- 2.39.5