From d782cd629af1050a439383ea29cd07b597099861 Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Sun, 11 Jul 2021 16:38:25 +0200 Subject: [PATCH] posix.cfg: Added overlapping data check for bcopy(). --- cfg/posix.cfg | 1 + test/cfg/posix.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/cfg/posix.cfg b/cfg/posix.cfg index 053092eb3..afffdd2fa 100644 --- a/cfg/posix.cfg +++ b/cfg/posix.cfg @@ -3803,6 +3803,7 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s false + diff --git a/test/cfg/posix.c b/test/cfg/posix.c index e9740a6bc..ac7e4c6ea 100644 --- a/test/cfg/posix.c +++ b/test/cfg/posix.c @@ -29,6 +29,18 @@ #include #include +void overlappingWriteFunction_bcopy(char *buf, const size_t count) +{ + // No warning shall be shown: + // cppcheck-suppress bcopyCalled + bcopy(&buf[0], &buf[3], count); // size is not known + // cppcheck-suppress bcopyCalled + bcopy(&buf[0], &buf[3], 3U); // no-overlap + // cppcheck-suppress bcopyCalled + // cppcheck-suppress overlappingWriteFunction + bcopy(&buf[0], &buf[3], 4U); +} + void overlappingWriteFunction_memccpy(unsigned char *src, unsigned char *dest, int c, size_t count) { // No warning shall be shown: