From f3fc5892e1b80693c0404fc48ff836ea2dd4eb3d Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Wed, 20 Apr 2022 17:58:50 +0200 Subject: [PATCH] posix.cfg: Ensure null pointer input is correctly handled for strsep(). --- test/cfg/posix.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/cfg/posix.c b/test/cfg/posix.c index ef1ecb546..83aba078f 100644 --- a/test/cfg/posix.c +++ b/test/cfg/posix.c @@ -226,6 +226,16 @@ char * nullPointer_stpcpy(char *src, char *dest) return stpcpy(NULL, src); } +char * nullPointer_strsep(char **stringptr, char *delim) +{ + // No warning shall be shown: + (void) strsep(stringptr, delim); + // cppcheck-suppress nullPointer + (void) strsep(stringptr, NULL); + // cppcheck-suppress nullPointer + return strsep(NULL, delim); +} + void overlappingWriteFunction_bcopy(char *buf, const size_t count) { // No warning shall be shown: