libroot: Fix handling of n=0 in mbrtowc.

Fixes #18350.
This commit is contained in:
Augustin Cavalier 2023-04-10 11:25:15 -04:00
parent f6395def52
commit 5cbb772a4d

View File

@ -34,6 +34,8 @@ __mbrtowc(wchar_t* pwc, const char* s, size_t n, mbstate_t* ps)
if (s == NULL)
return __mbrtowc(NULL, "", 1, ps);
if (n == 0)
return (size_t)-2;
LocaleBackend* backend = GetCurrentLocaleBackend();