Author: ache
Date: Fri Jun  3 07:34:59 2016
New Revision: 301245
URL: https://svnweb.freebsd.org/changeset/base/301245

Log:
  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 <r...@abittechnical.com> (partially)

Modified:
  stable/10/lib/libc/locale/ascii.c
  stable/10/lib/libc/locale/none.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/locale/ascii.c
==============================================================================
--- stable/10/lib/libc/locale/ascii.c   Fri Jun  3 07:24:41 2016        
(r301244)
+++ stable/10/lib/libc/locale/ascii.c   Fri Jun  3 07:34:59 2016        
(r301245)
@@ -143,6 +143,7 @@ _ascii_mbsnrtowcs(wchar_t * __restrict d
        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,
        nchr = 0;
        while (len-- > 0 && nwc-- > 0) {
                if (*s < 0 || *s > 127) {
+                       *src = s;
                        errno = EILSEQ;
                        return ((size_t)-1);
                }

Modified: stable/10/lib/libc/locale/none.c
==============================================================================
--- stable/10/lib/libc/locale/none.c    Fri Jun  3 07:24:41 2016        
(r301244)
+++ stable/10/lib/libc/locale/none.c    Fri Jun  3 07:34:59 2016        
(r301245)
@@ -172,6 +172,7 @@ _none_wcsnrtombs(char * __restrict dst, 
        nchr = 0;
        while (len-- > 0 && nwc-- > 0) {
                if (*s < 0 || *s > UCHAR_MAX) {
+                       *src = s;
                        errno = EILSEQ;
                        return ((size_t)-1);
                }
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to