posix.cfg: Added overlapping data check for bcopy().

This commit is contained in:
orbitcowboy 2021-07-11 16:38:25 +02:00
parent 9fb33e6a3c
commit d782cd629a
2 changed files with 13 additions and 0 deletions

View File

@ -3803,6 +3803,7 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
<function name="bcopy">
<noreturn>false</noreturn>
<leak-ignore/>
<not-overlapping-data ptr1-arg="1" ptr2-arg="2" size-arg="3"/>
<arg nr="1" direction="in">
<not-null/>
<not-uninit/>

View File

@ -29,6 +29,18 @@
#include <wchar.h>
#include <string.h>
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: