Sfoglia il codice sorgente

fix broken wmemchr (unbounded search)

Rich Felker 14 anni fa
parent
commit
a012aa879f
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  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;
 }