Skip to content

Commit f3fc589

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

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
@@ -226,6 +226,16 @@ char * nullPointer_stpcpy(char *src, char *dest)
226226
return stpcpy(NULL, src);
227227
}
228228

229+
char * nullPointer_strsep(char **stringptr, char *delim)
230+
{
231+
// No warning shall be shown:
232+
(void) strsep(stringptr, delim);
233+
// cppcheck-suppress nullPointer
234+
(void) strsep(stringptr, NULL);
235+
// cppcheck-suppress nullPointer
236+
return strsep(NULL, delim);
237+
}
238+
229239
void overlappingWriteFunction_bcopy(char *buf, const size_t count)
230240
{
231241
// No warning shall be shown:

0 commit comments

Comments
 (0)