diff options
author | Andrey A. Chernov <ache@FreeBSD.org> | 2016-05-31 18:44:33 +0000 |
---|---|---|
committer | Andrey A. Chernov <ache@FreeBSD.org> | 2016-05-31 18:44:33 +0000 |
commit | 2f423a266afffe83b43c5b369aa40a553902f693 (patch) | |
tree | ade5c0fe7dc1339fa4d0bcf766a9730cd06f5408 /lib/libc | |
parent | dd6aada3364abfb8c4a893604e08ef0ad82612f9 (diff) |
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
Notes
Notes:
svn path=/head/; revision=301069
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/locale/ascii.c | 2 | ||||
-rw-r--r-- | lib/libc/locale/none.c | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/lib/libc/locale/ascii.c b/lib/libc/locale/ascii.c index 784814d2664d..a70d71a7b88c 100644 --- a/lib/libc/locale/ascii.c +++ b/lib/libc/locale/ascii.c @@ -143,6 +143,7 @@ _ascii_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src, nchr = 0; while (len-- > 0 && nms-- > 0) { if (*s & 0x80) { + *src = s; errno = EILSEQ; return ((size_t)-1); } @@ -177,6 +178,7 @@ _ascii_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src, nchr = 0; while (len-- > 0 && nwc-- > 0) { if (*s < 0 || *s > 127) { + *src = s; errno = EILSEQ; return ((size_t)-1); } diff --git a/lib/libc/locale/none.c b/lib/libc/locale/none.c index c4695fd1222a..4e5a61d99540 100644 --- a/lib/libc/locale/none.c +++ b/lib/libc/locale/none.c @@ -174,6 +174,7 @@ _none_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src, nchr = 0; while (len-- > 0 && nwc-- > 0) { if (*s < 0 || *s > UCHAR_MAX) { + *src = s; errno = EILSEQ; return ((size_t)-1); } |