Skip to content

Commit a8a821a

Browse files
committed
posix.cfg: Ensure null pointer input is correctly handled for strncasecmp().
1 parent f3fc589 commit a8a821a

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

test/cfg/posix.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,16 @@ char * overlappingWriteFunction_stpcpy(char *src, char *dest)
216216
return stpcpy(src, src);
217217
}
218218

219+
int nullPointer_strncasecmp(char *a, char *b, size_t n)
220+
{
221+
// No warning shall be shown:
222+
(void) strncasecmp(a, b, n);
223+
// cppcheck-suppress nullPointer
224+
(void) strncasecmp(a, NULL, n);
225+
// cppcheck-suppress nullPointer
226+
return strncasecmp(NULL, b, n);
227+
}
228+
219229
char * nullPointer_stpcpy(char *src, char *dest)
220230
{
221231
// No warning shall be shown:

0 commit comments

Comments
 (0)