Fix unistr.c::ntfs_mbstoucs on systems with utf8 locale.

edge.strict_endians
cha0smaster 2005-07-28 21:20:23 +00:00
parent 1a029f788e
commit fb433d4ad3
2 changed files with 6 additions and 3 deletions

View File

@ -15,6 +15,7 @@ xx/xx/xxxx - 1.12.0-WIP
extent. (Szaka)
- ntfscp: fix attribute name parsing bug introduced in 1.10.0. (Yura)
- ntfsinfo: dump more information for indexes. (Yura)
- Fix unistr.c::ntfs_mbstoucs on systems with utf8 locale. (Yura)
20/07/2005 - 1.11.1 - Fix several ntfsmount bugs.

View File

@ -467,7 +467,7 @@ int ntfs_mbstoucs(const char *ins, ntfschar **outs, int outs_len)
ntfschar *ucs;
const char *s;
wchar_t wc;
int i, o, cnt, ins_len, ucs_len;
int i, o, cnt, ins_len, ucs_len, ins_size;
#ifdef HAVE_MBSINIT
mbstate_t mbstate;
#endif
@ -482,6 +482,8 @@ int ntfs_mbstoucs(const char *ins, ntfschar **outs, int outs_len)
errno = ENAMETOOLONG;
return -1;
}
/* Determine the size of the multi-byte string in bytes. */
ins_size = strlen(ins);
/* Determine the length of the multi-byte string. */
s = ins;
#if defined(HAVE_MBSINIT)
@ -543,9 +545,9 @@ int ntfs_mbstoucs(const char *ins, ntfschar **outs, int outs_len)
}
/* Convert the multibyte character to a wide character. */
#ifdef HAVE_MBSINIT
cnt = mbrtowc(&wc, ins + i, ins_len - i, &mbstate);
cnt = mbrtowc(&wc, ins + i, ins_size - i, &mbstate);
#else
cnt = mbtowc(&wc, ins + i, ins_len - i);
cnt = mbtowc(&wc, ins + i, ins_size - i);
#endif
if (!cnt)
break;