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