Scan the source string for invalid wide characters in wcsrtombs()
in the dst == NULL case.
This commit is contained in:
parent
b495040835
commit
18b2031298
@ -148,8 +148,15 @@ _none_wcsrtombs(char * __restrict dst, const wchar_t ** __restrict src,
|
||||
const wchar_t *s;
|
||||
size_t nchr;
|
||||
|
||||
if (dst == NULL)
|
||||
return (wcslen(*src));
|
||||
if (dst == NULL) {
|
||||
for (s = *src; *s != L'\0'; s++) {
|
||||
if (*s < 0 || *s > UCHAR_MAX) {
|
||||
errno = EILSEQ;
|
||||
return ((size_t)-1);
|
||||
}
|
||||
}
|
||||
return (s - *src);
|
||||
}
|
||||
|
||||
s = *src;
|
||||
nchr = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user