summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2016-05-31 18:44:33 +0000
committerache <ache@FreeBSD.org>2016-05-31 18:44:33 +0000
commit0abc93ce5b1ceb108839b29caffb4b950a77244f (patch)
treeade5c0fe7dc1339fa4d0bcf766a9730cd06f5408 /lib/libc
parent14093b648e561c01a0296ffae6244b61f7927833 (diff)
downloadFreeBSD-src-0abc93ce5b1ceb108839b29caffb4b950a77244f.zip
FreeBSD-src-0abc93ce5b1ceb108839b29caffb4b950a77244f.tar.gz
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
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/locale/ascii.c2
-rw-r--r--lib/libc/locale/none.c1
2 files changed, 3 insertions, 0 deletions
diff --git a/lib/libc/locale/ascii.c b/lib/libc/locale/ascii.c
index 784814d..a70d71a 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 c4695fd..4e5a61d 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);
}
OpenPOWER on IntegriCloud