fix wcsncpy writing past end of buffer
This commit is contained in:
parent
19892bf0a7
commit
e98136207a
1 changed files with 1 additions and 1 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
wchar_t *wcsncpy(wchar_t *d, const wchar_t *s, size_t n)
|
wchar_t *wcsncpy(wchar_t *d, const wchar_t *s, size_t n)
|
||||||
{
|
{
|
||||||
wchar_t *a = d;
|
wchar_t *a = d;
|
||||||
while (n && (*d++ = *s++)) n--;
|
for (; n && (*d = *s); n--, d++, s++);
|
||||||
wmemset(d, 0, n);
|
wmemset(d, 0, n);
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue