From 2e1ae3b6b9331383ba5eaa7cb47373a8bea073d1 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 18 Dec 2014 16:42:21 -0500 Subject: [PATCH] fix return value computation in one code path of wcsnrtombs the affected code was wrongly counting characters instead of bytes. --- src/multibyte/wcsnrtombs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/multibyte/wcsnrtombs.c b/src/multibyte/wcsnrtombs.c index 7eb05d45..ee4a534a 100644 --- a/src/multibyte/wcsnrtombs.c +++ b/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; -- GitLab