Print this page
5366 strcoll_l may destroy its arguments, then crash
*** 37,51 ****
size_t
mbstowcs_l(wchar_t *_RESTRICT_KYWD pwcs, const char *_RESTRICT_KYWD s,
size_t n, locale_t loc)
{
! static const mbstate_t initial = { 0 };
! mbstate_t mbs;
const char *sp;
- mbs = initial;
sp = s;
return (loc->ctype->lc_mbsnrtowcs(pwcs, &sp, ULONG_MAX, n, &mbs));
}
size_t
--- 37,49 ----
size_t
mbstowcs_l(wchar_t *_RESTRICT_KYWD pwcs, const char *_RESTRICT_KYWD s,
size_t n, locale_t loc)
{
! mbstate_t mbs = { 0 };
const char *sp;
sp = s;
return (loc->ctype->lc_mbsnrtowcs(pwcs, &sp, ULONG_MAX, n, &mbs));
}
size_t