summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2016-06-03 07:34:59 +0000
committerache <ache@FreeBSD.org>2016-06-03 07:34:59 +0000
commitea8615c3032a52063cfb42147a04788ca2627827 (patch)
tree98fc5a6411801048b09849c5a0e3973e4a7f3141 /lib
parent84d7d3078285fa2f1456ebdf40ba393524b4c84f (diff)
downloadFreeBSD-src-ea8615c3032a52063cfb42147a04788ca2627827.zip
FreeBSD-src-ea8615c3032a52063cfb42147a04788ca2627827.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)
Diffstat (limited to 'lib')
-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 75adffa..41835ee 100644
--- a/lib/libc/locale/none.c
+++ b/lib/libc/locale/none.c
@@ -172,6 +172,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