projects
/
musl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b90841e
)
mbrtowc: Fix wrong return value when n > UINT_MAX
author
Alexey Izbyshev
<izbyshev@ispras.ru>
Fri, 26 May 2023 16:34:14 +0000
(19:34 +0300)
committer
Rich Felker
<dalias@aerifal.cx>
Fri, 26 May 2023 20:12:29 +0000
(16:12 -0400)
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.
src/multibyte/mbrtowc.c
patch
|
blob
|
history
diff --git
a/src/multibyte/mbrtowc.c
b/src/multibyte/mbrtowc.c
index
c94819e
..
7824997
100644
(file)
--- a/
src/multibyte/mbrtowc.c
+++ b/
src/multibyte/mbrtowc.c
@@
-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;