fix failure of mbsrtowcs to record stop position when dest is full
authorRich Felker <dalias@aerifal.cx>
Sat, 29 Jun 2013 20:16:47 +0000 (16:16 -0400)
committerRich Felker <dalias@aerifal.cx>
Sat, 29 Jun 2013 20:16:47 +0000 (16:16 -0400)
src/multibyte/mbsrtowcs.c

index 75a493c4f5f383cab76c2d8b708509954f42cb92..b9bbc33daf54c7071c2a527c9eb725d5a912f30d 100644 (file)
@@ -54,7 +54,10 @@ resume0:
                wn--;
                c = 0;
        } else for (;;) {
-               if (!wn) return wn0;
+               if (!wn) {
+                       *src = (const void *)s;
+                       return wn0;
+               }
                if (*s-1u < 0x7f && (uintptr_t)s%4 == 0) {
                        while (wn>=4 && !(( *(uint32_t*)s | *(uint32_t*)s-0x01010101) & 0x80808080)) {
                                *ws++ = *s++;