Skip to content

Commit e704136

Browse files
committed
cherry-pick musl 1.1.3 wcsxfrm.c, fixes #2473
1 parent d3612d7 commit e704136

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

system/lib/libc/musl/src/locale/wcsxfrm.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
size_t __wcsxfrm_l(wchar_t *restrict dest, const wchar_t *restrict src, size_t n, locale_t loc)
77
{
88
size_t l = wcslen(src);
9-
if (l >= n) {
9+
if (l < n) {
10+
wmemcpy(dest, src, l+1);
11+
} else if (n) {
1012
wmemcpy(dest, src, n-1);
1113
dest[n-1] = 0;
12-
} else wcscpy(dest, src);
14+
}
1315
return l;
1416
}
1517

0 commit comments

Comments
 (0)