projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
19892bf
)
fix wcsncpy writing past end of buffer
author
Rich Felker
<dalias@aerifal.cx>
Mon, 23 May 2011 01:54:42 +0000
(21:54 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Mon, 23 May 2011 01:54:42 +0000
(21:54 -0400)
src/string/wcsncpy.c
patch
|
blob
|
history
diff --git
a/src/string/wcsncpy.c
b/src/string/wcsncpy.c
index 0164208de648458cd849bd157325690f6349704b..9f68a004d4940fd8b8b0dba1ce7165b4ebc7e8ac 100644
(file)
--- 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;
}