std.cfg: Added more test for strncpy().

This commit is contained in:
orbitcowboy 2022-04-21 16:47:19 +02:00
parent 7f48127c0b
commit e683f3ce28
2 changed files with 20 additions and 0 deletions

View File

@ -3459,6 +3459,16 @@ void nullPointer_strncat(char *d, char *s, size_t n)
(void)strncat(d,s,n);
}
void nullPointer_strncpy(char *d, const char *s, size_t n)
{
// cppcheck-suppress nullPointer
(void)strncpy(NULL,s,n);
// cppcheck-suppress nullPointer
(void)strncpy(d,NULL,n);
// no warning is expected for
(void)strncpy(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)
{

View File

@ -1293,6 +1293,16 @@ void nullPointer_strncat(char *d, char *s, size_t n)
(void)std::strncat(d,s,n);
}
void nullPointer_strncpy(char *d, const char *s, size_t n)
{
// cppcheck-suppress nullPointer
(void)std::strncpy(NULL,s,n);
// cppcheck-suppress nullPointer
(void)std::strncpy(d,NULL,n);
// no warning is expected for
(void)std::strncpy(d,s,n);
}
void nullPointer_strncmp(const char *s1, const char *s2, size_t n)
{
// cppcheck-suppress nullPointer