wc: avoid undefined conversion state

* src/wc.c (wc): When mbrtowc returns (size_t) -1, zero the
conversion state, since POSIX says it’s undefined.
This commit is contained in:
Paul Eggert committed 2023-09-23 00:28:26 -07:00
1 parent 092f8178c0
commit fb51f74ff6
1 file changed
+2
+2
View File
@@ -519,6 +519,8 @@ wc (int fd, char const *file_x, struct fstatus *fstatus, off_t current_pos)
character (that is, chars is not incremented). */
p++;
bytes_read--;
mbszero (&state);
in_shift = false;
continue;
}
if (mbsinit (&state))