mirror of
git://git.musl-libc.org/musl
synced 2025-03-06 20:48:29 +01:00
mbrtowc: Fix wrong return value when n > UINT_MAX
mbrtowc truncates n to unsigned int when storing its copy. If n > UINT_MAX and the locale is not POSIX, the function will return a wrong value greater than UINT_MAX on the success path.
This commit is contained in:
parent
b90841e258
commit
4653b98711
1 changed files with 1 additions and 1 deletions
|
@ -8,7 +8,7 @@ size_t mbrtowc(wchar_t *restrict wc, const char *restrict src, size_t n, mbstate
|
|||
static unsigned internal_state;
|
||||
unsigned c;
|
||||
const unsigned char *s = (const void *)src;
|
||||
const unsigned N = n;
|
||||
const size_t N = n;
|
||||
wchar_t dummy;
|
||||
|
||||
if (!st) st = (void *)&internal_state;
|
||||
|
|
Loading…
Add table
Reference in a new issue