Skip to content

Commit 4905754

Browse files
committed
std.cfg: Ensure a warning is issued for null pointer input for strlen().
1 parent 3bd65d4 commit 4905754

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

test/cfg/std.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,13 @@ void nullpointer(int value)
381381
wscanf(L"%i", NULL);
382382
}
383383

384+
size_t nullPointer_strlen(const char *s)
385+
{
386+
// cppcheck-suppress nullPointer
387+
(void) strlen(NULL);
388+
return strlen(s);
389+
}
390+
384391
void nullpointerMemchr1(char *p, char *s)
385392
{
386393
p = memchr(s, 'p', strlen(s));

0 commit comments

Comments
 (0)