about summary refs log tree commit diff
path: root/src/string/wmemchr.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-03-17 22:38:45 -0400
committerRich Felker <dalias@aerifal.cx>2011-03-17 22:38:45 -0400
commita012aa879fb790c8e0446638b206b7f34e92c51e (patch)
tree7e10cf714e5a947158a1799529b186321545ec15 /src/string/wmemchr.c
parent047e434ef5fd5437a74f98f63c40a77a683f7f3f (diff)
downloadmusl-a012aa879fb790c8e0446638b206b7f34e92c51e.tar.gz
musl-a012aa879fb790c8e0446638b206b7f34e92c51e.tar.xz
musl-a012aa879fb790c8e0446638b206b7f34e92c51e.zip
fix broken wmemchr (unbounded search)
Diffstat (limited to 'src/string/wmemchr.c')
-rw-r--r--src/string/wmemchr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/string/wmemchr.c b/src/string/wmemchr.c
index a3ee0e61..37d69629 100644
--- a/src/string/wmemchr.c
+++ b/src/string/wmemchr.c
@@ -3,6 +3,6 @@
 
 wchar_t *wmemchr(const wchar_t *s, wchar_t c, size_t n)
 {
-	for (; n && *s != c; s++);
+	for (; n && *s != c; n--, s++);
 	return n ? (wchar_t *)s : 0;
 }