diff --git a/test/cfg/std.c b/test/cfg/std.c index cb7f0b987..8c96ae5ae 100644 --- a/test/cfg/std.c +++ b/test/cfg/std.c @@ -3449,6 +3449,16 @@ void uninitvar_strncat(char *d, char *s, size_t n) (void)strncat(d,s,n); } +void nullPointer_strncat(char *d, char *s, size_t n) +{ + // cppcheck-suppress nullPointer + (void)strncat(NULL,s,n); + // cppcheck-suppress nullPointer + (void)strncat(d,NULL,n); + // no warning is expected for + (void)strncat(d,s,n); +} + // errno_t strcat_s(char *restrict dest, rsize_t destsz, const char *restrict src); // since C11 void uninitvar_strcat_s(char *Ct, size_t N, char *S) { diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp index 5bf9c7edf..057629e56 100644 --- a/test/cfg/std.cpp +++ b/test/cfg/std.cpp @@ -1283,6 +1283,16 @@ void nullPointer_wmemcmp(const wchar_t* s1, const wchar_t* s2, size_t n) (void)std::wmemcmp(s1,s2,n); } +void nullPointer_strncat(char *d, char *s, size_t n) +{ + // cppcheck-suppress nullPointer + (void)std::strncat(NULL,s,n); + // cppcheck-suppress nullPointer + (void)std::strncat(d,NULL,n); + // no warning is expected for + (void)std::strncat(d,s,n); +} + void nullPointer_strncmp(const char *s1, const char *s2, size_t n) { // cppcheck-suppress nullPointer