Skip to content

Commit c17d3a1

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

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+
char * nullPointer_stpcpy(char *src, char *dest)
220+
{
221+
// No warning shall be shown:
222+
(void) stpcpy(dest, src);
223+
// cppcheck-suppress nullPointer
224+
(void) stpcpy(dest, NULL);
225+
// cppcheck-suppress nullPointer
226+
return stpcpy(NULL, src);
227+
}
228+
219229
void overlappingWriteFunction_bcopy(char *buf, const size_t count)
220230
{
221231
// No warning shall be shown:

0 commit comments

Comments
 (0)