Sfoglia il codice sorgente

fix failure of mbsrtowcs to record stop position when dest is full

Rich Felker 11 anni fa
parent
commit
4ca442157e
1 ha cambiato i file con 4 aggiunte e 1 eliminazioni
  1. 4 1
      src/multibyte/mbsrtowcs.c

+ 4 - 1
src/multibyte/mbsrtowcs.c

@@ -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++;