posix.cfg: Improved configuration for wcsnrtombs().

This commit is contained in:
orbitcowboy 2022-04-25 15:49:37 +02:00
parent dd2e218bb4
commit 89ae22c0e1
2 changed files with 10 additions and 0 deletions

View File

@ -23,6 +23,7 @@
<leak-ignore/>
<arg nr="1" direction="out">
<not-bool/>
<minsize type="argvalue" arg="4"/>
</arg>
<arg nr="2" direction="in">
<not-null/>

View File

@ -38,6 +38,15 @@ int nullPointer_ttyname_r(int fd, char *buf, size_t buflen)
return ttyname_r(fd,buf,buflen);
}
size_t bufferAccessOutOfBounds_wcsnrtombs(char *restrict dest, const wchar_t **restrict src, size_t nwc, size_t len, mbstate_t *restrict ps)
{
char buf[42];
(void)wcsnrtombs(buf,src,nwc,42,ps);
// cppcheck-suppress bufferAccessOutOfBounds
(void)wcsnrtombs(buf,src,nwc,43,ps);
return wcsnrtombs(dest,src,nwc,len,ps);
}
size_t nullPointer_wcsnrtombs(char *restrict dest, const wchar_t **restrict src, size_t nwc, size_t len, mbstate_t *restrict ps)
{
// It is allowed to set the first arg to NULL