std.cfg: strxfrm(): Added minize values to arg1 and arg2 and a TODO test case

This commit is contained in:
orbitcowboy 2021-04-13 14:07:45 +02:00
parent cf211610d3
commit 040e58f943
2 changed files with 17 additions and 1 deletions

View File

@ -5088,10 +5088,15 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<noreturn>false</noreturn>
<leak-ignore/>
<!-- In case the 3rd argument is 0, the 1st argument is permitted to be a null pointer. (#6306) -->
<arg nr="1" direction="out"/>
<arg nr="1" direction="out">
<strz/>
<minsize type="argvalue" arg="3"/>
</arg>
<arg nr="2" direction="in">
<not-null/>
<not-uninit/>
<strz/>
<minsize type="argvalue" arg="3"/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>

View File

@ -3550,6 +3550,17 @@ void uninitvar_strxfrm(void)
(void)strxfrm(ds,ss,n);
}
void bufferAccessOutOfBounds_strxfrm(void)
{
const char src[3] = "abc";
char dest[1] = "a";
(void)strxfrm(dest,src,1);
// TODO cppcheck-suppress bufferAccessOutOfBounds
(void)strxfrm(dest,src,2);
// TODO cppcheck-suppress bufferAccessOutOfBounds
(void)strxfrm(dest,src,3);
}
void uninitvar_wcsxfrm(void)
{
wchar_t *ds;