Skip to content

Commit 89ae22c

Browse files
committed
posix.cfg: Improved configuration for wcsnrtombs().
1 parent dd2e218 commit 89ae22c

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

cfg/posix.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<leak-ignore/>
2424
<arg nr="1" direction="out">
2525
<not-bool/>
26+
<minsize type="argvalue" arg="4"/>
2627
</arg>
2728
<arg nr="2" direction="in">
2829
<not-null/>

test/cfg/posix.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ int nullPointer_ttyname_r(int fd, char *buf, size_t buflen)
3838
return ttyname_r(fd,buf,buflen);
3939
}
4040

41+
size_t bufferAccessOutOfBounds_wcsnrtombs(char *restrict dest, const wchar_t **restrict src, size_t nwc, size_t len, mbstate_t *restrict ps)
42+
{
43+
char buf[42];
44+
(void)wcsnrtombs(buf,src,nwc,42,ps);
45+
// cppcheck-suppress bufferAccessOutOfBounds
46+
(void)wcsnrtombs(buf,src,nwc,43,ps);
47+
return wcsnrtombs(dest,src,nwc,len,ps);
48+
}
49+
4150
size_t nullPointer_wcsnrtombs(char *restrict dest, const wchar_t **restrict src, size_t nwc, size_t len, mbstate_t *restrict ps)
4251
{
4352
// It is allowed to set the first arg to NULL

0 commit comments

Comments
 (0)