Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f6a05fd

Browse files
committed
Fix failure of new wchar->mb functions to advance from pointer.
Bug spotted by Tom Lane.
1 parent 2eeb5eb commit f6a05fd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/backend/utils/mb/wchar.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ pg_wchar2euc_with_len(const pg_wchar *from, unsigned char *to, int len)
380380
*to++ = *from;
381381
cnt++;
382382
}
383+
from++;
383384
len--;
384385
}
385386
*to = 0;
@@ -518,9 +519,10 @@ pg_wchar2utf_with_len(const pg_wchar *from, unsigned char *to, int len)
518519

519520
unicode_to_utf8(*from, to);
520521
char_len = pg_utf_mblen(to);
521-
len--;
522522
cnt += char_len;
523523
to += char_len;
524+
from++;
525+
len--;
524526
}
525527
*to = 0;
526528
return cnt;
@@ -854,6 +856,7 @@ pg_wchar2mule_with_len(const pg_wchar *from, unsigned char *to, int len)
854856
*to++ = lb;
855857
cnt += 1;
856858
}
859+
from++;
857860
len--;
858861
}
859862
*to = 0;

0 commit comments

Comments
 (0)