Check the returned value of memchr(3) before using it
Reported by: Coverity CID: 1338530
This commit is contained in:
parent
4dd13092b5
commit
d3591d68a9
@ -133,11 +133,14 @@ _ascii_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
|
||||
|
||||
if (dst == NULL) {
|
||||
s = memchr(*src, '\0', nms);
|
||||
if (s == NULL)
|
||||
return (nms);
|
||||
|
||||
if (*s & 0x80) {
|
||||
errno = EILSEQ;
|
||||
return ((size_t)-1);
|
||||
}
|
||||
return (s != NULL ? s - *src : nms);
|
||||
return (s - *src);
|
||||
}
|
||||
|
||||
s = *src;
|
||||
|
Loading…
Reference in New Issue
Block a user