diff --git a/cfg/std.cfg b/cfg/std.cfg index 0c9500257..7de265506 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -4916,6 +4916,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun false + diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp index 1d10031a7..26d56f6c9 100644 --- a/test/cfg/std.cpp +++ b/test/cfg/std.cpp @@ -93,6 +93,20 @@ char * overlappingWriteFunction_strcat(char *src, char *dest) return strcat(src, src); } +char * overlappingWriteFunction_strncat(char *src, char *dest, const std::size_t count) +{ + // No warning shall be shown: + (void)strncat(dest, src, 42); + (void)strncat(dest, src, count); + // cppcheck-suppress overlappingWriteFunction + (void)strncat(dest, dest+1, 2); + char buffer[] = "strncat"; + // cppcheck-suppress overlappingWriteFunction + (void)strncat(buffer, buffer + 1, 3); + // TODO-cppcheck-suppress overlappingWriteFunction + return strncat(src, src, count); +} + wchar_t * overlappingWriteFunction_wcscpy(wchar_t *src, wchar_t *dest) { // No warning shall be shown: