std.cfg: Fixed bufferAccessOutOfBounds false negative for strncmp().

This commit is contained in:
orbitcowboy 2021-04-13 19:13:00 +02:00
parent 03bdcc4c42
commit f62d9d5853
2 changed files with 15 additions and 0 deletions

View File

@ -5000,10 +5000,14 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<arg nr="1" direction="in">
<not-null/>
<not-uninit/>
<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

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