mirror of https://git.tukaani.org/xz.git
tuklib_mbstr_width: Use stricter return value checking
This should make no difference in practice (at least if mbrtowc() isn't broken).
This commit is contained in:
parent
b797c44c42
commit
3c16105936
|
@ -41,7 +41,7 @@ tuklib_mbstr_width(const char *str, size_t *bytes)
|
|||
while (i < len) {
|
||||
wchar_t wc;
|
||||
const size_t ret = mbrtowc(&wc, str + i, len - i, &state);
|
||||
if (ret < 1 || ret > len)
|
||||
if (ret < 1 || ret > len - i)
|
||||
return (size_t)-1;
|
||||
|
||||
i += ret;
|
||||
|
|
Loading…
Reference in New Issue