From: Rich Felker Date: Mon, 23 May 2011 01:54:42 +0000 (-0400) Subject: fix wcsncpy writing past end of buffer X-Git-Tag: v0.7.11~87 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e98136207ad1a6df1cdc1578e4ad56f8f0db4047;p=musl fix wcsncpy writing past end of buffer --- diff --git a/src/string/wcsncpy.c b/src/string/wcsncpy.c index 0164208d..9f68a004 100644 --- a/src/string/wcsncpy.c +++ b/src/string/wcsncpy.c @@ -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--; + for (; n && (*d = *s); n--, d++, s++); wmemset(d, 0, n); return a; }