diff options
author | Robert Haas <rhaas@postgresql.org> | 2012-07-05 23:47:53 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2012-07-05 23:47:53 -0400 |
commit | f6a05fd973a102f7e66c491d3f854864b8d24844 (patch) | |
tree | a645d52ae0ea1278bd24eb848d4ec34c6a03f768 | |
parent | 2eeb5eb23fa9ad1a2d636bbf2fd68e6709848d23 (diff) | |
download | postgresql-f6a05fd973a102f7e66c491d3f854864b8d24844.tar.gz postgresql-f6a05fd973a102f7e66c491d3f854864b8d24844.zip |
Fix failure of new wchar->mb functions to advance from pointer.
Bug spotted by Tom Lane.
-rw-r--r-- | src/backend/utils/mb/wchar.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/backend/utils/mb/wchar.c b/src/backend/utils/mb/wchar.c index 1755be5ebfa..54581cd12a5 100644 --- a/src/backend/utils/mb/wchar.c +++ b/src/backend/utils/mb/wchar.c @@ -380,6 +380,7 @@ pg_wchar2euc_with_len(const pg_wchar *from, unsigned char *to, int len) *to++ = *from; cnt++; } + from++; len--; } *to = 0; @@ -518,9 +519,10 @@ pg_wchar2utf_with_len(const pg_wchar *from, unsigned char *to, int len) unicode_to_utf8(*from, to); char_len = pg_utf_mblen(to); - len--; cnt += char_len; to += char_len; + from++; + len--; } *to = 0; return cnt; @@ -854,6 +856,7 @@ pg_wchar2mule_with_len(const pg_wchar *from, unsigned char *to, int len) *to++ = lb; cnt += 1; } + from++; len--; } *to = 0; |