fix strncat and wcsncat (double null termination)
[musl] / src / string / strncat.c
index 255b7a7..08685ad 100644 (file)
@@ -4,7 +4,7 @@ char *strncat(char *d, const char *s, size_t n)
 {
        char *a = d;
        d += strlen(d);
-       while (n && (*d++ = *s++)) n--;
+       while (n && *s) n--, *d++ = *s++;
        *d++ = 0;
        return a;
 }