For EILSEQ case in mbsnrtowcs() and wcsnrtombs() update src to point to

the character after the one this conversion stopped at.

PR:     209907
Submitted by: Roel Standaert <roel@abittechnical.com> (partially)
MFC after:      3 days
This commit is contained in:
Andrey A. Chernov 2016-05-31 18:44:33 +00:00
parent dd6aada336
commit 2f423a266a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=301069
2 changed files with 3 additions and 0 deletions

View File

@ -143,6 +143,7 @@ _ascii_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
nchr = 0; nchr = 0;
while (len-- > 0 && nms-- > 0) { while (len-- > 0 && nms-- > 0) {
if (*s & 0x80) { if (*s & 0x80) {
*src = s;
errno = EILSEQ; errno = EILSEQ;
return ((size_t)-1); return ((size_t)-1);
} }
@ -177,6 +178,7 @@ _ascii_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src,
nchr = 0; nchr = 0;
while (len-- > 0 && nwc-- > 0) { while (len-- > 0 && nwc-- > 0) {
if (*s < 0 || *s > 127) { if (*s < 0 || *s > 127) {
*src = s;
errno = EILSEQ; errno = EILSEQ;
return ((size_t)-1); return ((size_t)-1);
} }

View File

@ -174,6 +174,7 @@ _none_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src,
nchr = 0; nchr = 0;
while (len-- > 0 && nwc-- > 0) { while (len-- > 0 && nwc-- > 0) {
if (*s < 0 || *s > UCHAR_MAX) { if (*s < 0 || *s > UCHAR_MAX) {
*src = s;
errno = EILSEQ; errno = EILSEQ;
return ((size_t)-1); return ((size_t)-1);
} }