Correctly handle incomplete characters.
authordrepper <drepper>
Wed, 26 Nov 1997 04:21:37 +0000 (04:21 +0000)
committerdrepper <drepper>
Wed, 26 Nov 1997 04:21:37 +0000 (04:21 +0000)
wcsmbs/wcsnrtombs.c

index ddd4e95..f6c8048 100644 (file)
@@ -63,7 +63,12 @@ __wcsnrtombs (dst, src, nwc, len, ps)
 
   while (written < len && nwc-- > 0)
     {
-      wchar_t wc = *run++;
+      wchar_t wc;
+
+      /* Store position of first unprocessed word.  */
+      *src = run;
+
+      wc = *run++;
 
       if (wc < 0 || wc > 0x7fffffff)
        {