std.cfg: Added more tests for strcat() and strcpy().

This commit is contained in:
orbitcowboy 2022-04-21 16:59:25 +02:00
parent e683f3ce28
commit ce35a6c975
2 changed files with 44 additions and 0 deletions

View File

@ -3113,6 +3113,28 @@ void uninitvar_strcat(char *dest, const char * const source)
(void)strcat(dest,source);
}
void nullPointer_strcpy(char *dest, const char * const source)
{
// cppcheck-suppress nullPointer
(void)strcpy(NULL,source);
// cppcheck-suppress nullPointer
(void)strcpy(dest,NULL);
// no warning shall be shown for
(void)strcpy(dest,source);
}
void nullPointer_strcat(char *dest, const char * const source)
{
// cppcheck-suppress nullPointer
(void)strcat(NULL,source);
// cppcheck-suppress nullPointer
(void)strcat(dest,NULL);
// no warning shall be shown for
(void)strcat(dest,source);
}
void bufferAccessOutOfBounds_strcat(char *dest, const char * const source)
{
char buf4[4] = {0};

View File

@ -1293,6 +1293,28 @@ void nullPointer_strncat(char *d, char *s, size_t n)
(void)std::strncat(d,s,n);
}
void nullPointer_strcpy(char *dest, const char * const source)
{
// cppcheck-suppress nullPointer
(void)std::strcpy(NULL,source);
// cppcheck-suppress nullPointer
(void)std::strcpy(dest,NULL);
// no warning shall be shown for
(void)std::strcpy(dest,source);
}
void nullPointer_strcat(char *dest, const char * const source)
{
// cppcheck-suppress nullPointer
(void)std::strcat(NULL,source);
// cppcheck-suppress nullPointer
(void)std::strcat(dest,NULL);
// no warning shall be shown for
(void)std::strcat(dest,source);
}
void nullPointer_strncpy(char *d, const char *s, size_t n)
{
// cppcheck-suppress nullPointer