projects
/
users
/
simon
/
postgres.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
17b33b6
)
Code review of strftime patch, per comments from Tom:
author
Magnus Hagander
<magnus@hagander.net>
Fri, 9 Jan 2009 14:07:00 +0000
(14:07 +0000)
committer
Magnus Hagander
<magnus@hagander.net>
Fri, 9 Jan 2009 14:07:00 +0000
(14:07 +0000)
* Use correct buffer size MAX_L10N_DATA
* Use strlcpy instead of StrNCpy
src/backend/utils/adt/pg_locale.c
patch
|
blob
|
blame
|
history
diff --git
a/src/backend/utils/adt/pg_locale.c
b/src/backend/utils/adt/pg_locale.c
index 769a6d5cbc8be82c3fbbba7e620bcd2708d10c99..b8f553fbf74f74d98dcddd1943d0898eb3365f23 100644
(file)
--- 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)
{
-
StrNC
py(dst, convstr, dstlen);
+
strlc
py(dst, convstr, dstlen);
len = strlen(dst);
}
}