Explorar o código

fix return value computation in one code path of wcsnrtombs

the affected code was wrongly counting characters instead of bytes.
Rich Felker %!s(int64=10) %!d(string=hai) anos
pai
achega
2e1ae3b6b9
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/multibyte/wcsnrtombs.c

+ 1 - 1
src/multibyte/wcsnrtombs.c

@@ -40,7 +40,7 @@ size_t wcsnrtombs(char *restrict dst, const wchar_t **restrict wcs, size_t wn, s
 		ws++; wn--;
 		/* safe - this loop runs fewer than sizeof(buf) times */
 		s+=l; n-=l;
-		cnt++;
+		cnt += l;
 	}
 	if (dst) *wcs = ws;
 	return cnt;