From 7cbdea9b813d6ddbfc8c6b94e64e7a841db817bd Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Wed, 20 Apr 2022 18:15:54 +0200 Subject: [PATCH] posix.cfg: Ensure null pointer input is correctly handled for strcasecmp(). --- test/cfg/posix.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/cfg/posix.c b/test/cfg/posix.c index ce59ee363..1bc2d534a 100644 --- a/test/cfg/posix.c +++ b/test/cfg/posix.c @@ -216,6 +216,16 @@ char * overlappingWriteFunction_stpcpy(char *src, char *dest) return stpcpy(src, src); } +int nullPointer_strcasecmp(char *a, char *b) +{ + // No warning shall be shown: + (void) strcasecmp(a, b); + // cppcheck-suppress nullPointer + (void) strcasecmp(a, NULL); + // cppcheck-suppress nullPointer + return strcasecmp(NULL, b); +} + int nullPointer_strncasecmp(char *a, char *b, size_t n) { // No warning shall be shown: