aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/locale/ascii.c
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>2016-05-31 18:44:33 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>2016-05-31 18:44:33 +0000
commit2f423a266afffe83b43c5b369aa40a553902f693 (patch)
treeade5c0fe7dc1339fa4d0bcf766a9730cd06f5408 /lib/libc/locale/ascii.c
parentdd6aada3364abfb8c4a893604e08ef0ad82612f9 (diff)
downloadsrc-2f423a266afffe83b43c5b369aa40a553902f693.tar.gz
src-2f423a266afffe83b43c5b369aa40a553902f693.zip
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/locale/ascii.c')
-rw-r--r--lib/libc/locale/ascii.c2
1 files changed, 2 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);
}