Explorar o código

fix broken wmemchr (unbounded search)

Rich Felker %!s(int64=14) %!d(string=hai) anos
pai
achega
a012aa879f
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/string/wmemchr.c

+ 1 - 1
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;
 }