fix strncat and wcsncat (double null termination)
[musl] / src / string / wcsncpy.c
index 9f68a00..714eeb6 100644 (file)
@@ -3,7 +3,7 @@
 wchar_t *wcsncpy(wchar_t *d, const wchar_t *s, size_t n)
 {
        wchar_t *a = d;
 wchar_t *wcsncpy(wchar_t *d, const wchar_t *s, size_t n)
 {
        wchar_t *a = d;
-       for (; n && (*d = *s); n--, d++, s++);
+       while (n && *s) n--, *d++ = *s++;
        wmemset(d, 0, n);
        return a;
 }
        wmemset(d, 0, n);
        return a;
 }