posix.cfg: Improved configuration for swab().

This commit is contained in:
orbitcowboy 2022-04-25 18:34:31 +02:00
parent d1b6954dd8
commit d7063806d1
2 changed files with 25 additions and 0 deletions

View File

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

View File

@ -431,6 +431,30 @@ void overlappingWriteFunction_swab(char *src, char *dest, ssize_t n)
swab(src, src+3, 4);
}
void bufferAccessOutOfBounds_swab(char *src, char *dest, ssize_t n)
{
// No warning shall be shown:
swab(dest, src, n);
char srcBuf[42] = {0};
char destBuf[42] = {0};
swab(srcBuf, dest, 42);
// cppcheck-suppress bufferAccessOutOfBounds
swab(srcBuf, dest, 43);
swab(src, destBuf, 42);
// cppcheck-suppress bufferAccessOutOfBounds
swab(src, destBuf, 43);
}
void nullPointer_swab(char *src, char *dest, ssize_t n)
{
// No warning shall be shown:
swab(dest, src, n);
// cppcheck-suppress nullPointer
swab(NULL, dest, n);
// cppcheck-suppress nullPointer
swab(src, NULL, n);
}
bool invalidFunctionArgBool_isascii(bool b, int c)
{
// cppcheck-suppress invalidFunctionArgBool