std.cfg: Added invalidFunctionArg cfg for strchr().

This commit is contained in:
orbitcowboy 2018-11-20 08:32:54 +01:00
parent 60ce95c1ec
commit 58b3d75b62
2 changed files with 14 additions and 0 deletions

View File

@ -4546,6 +4546,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
</arg>
<arg nr="2">
<not-uninit/>
<valid>0:255</valid>
</arg>
</function>
<!-- wchar_t wcschr(const wchar_t *cs, wchar_t c); -->

View File

@ -2901,6 +2901,19 @@ void uninitvar_strchr(void)
(void)strchr(cs,c);
}
void invalidFunctionArg_strchr(char *cs, int c)
{
// cppcheck-suppress invalidFunctionArg
(void)strchr(cs,-1);
// No warning shall be issued for
(void)strchr(cs, 0);
(void)strchr(cs, 255);
// cppcheck-suppress invalidFunctionArg
(void)strchr(cs, 256);
}
void uninitvar_wcschr(void)
{
wchar_t *cs;