posix.cfg: Improved configuration for bzero() and added tests.
This commit is contained in:
parent
7c9b9a65b1
commit
1fb1b22bae
|
@ -3983,6 +3983,7 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<arg nr="1" direction="out">
|
<arg nr="1" direction="out">
|
||||||
<not-null/>
|
<not-null/>
|
||||||
|
<minsize type="argvalue" arg="2"/>
|
||||||
</arg>
|
</arg>
|
||||||
<arg nr="2" direction="in">
|
<arg nr="2" direction="in">
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
|
|
|
@ -249,6 +249,29 @@ int nullPointer_bcmp(const void *a, const void *b, size_t n)
|
||||||
return bcmp(NULL, b, n);
|
return bcmp(NULL, b, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nullPointer_bzero(void *s, size_t n)
|
||||||
|
{
|
||||||
|
// cppcheck-suppress nullPointer
|
||||||
|
// cppcheck-suppress bzeroCalled
|
||||||
|
bzero(NULL,n);
|
||||||
|
// No nullPointer-warning shall be shown:
|
||||||
|
// cppcheck-suppress bzeroCalled
|
||||||
|
bzero(s,n);
|
||||||
|
}
|
||||||
|
|
||||||
|
void bufferAccessOutOfBounds_bzero(void *s, size_t n)
|
||||||
|
{
|
||||||
|
char buf[42];
|
||||||
|
// cppcheck-suppress bufferAccessOutOfBounds
|
||||||
|
// cppcheck-suppress bzeroCalled
|
||||||
|
bzero(buf,43);
|
||||||
|
// cppcheck-suppress bzeroCalled
|
||||||
|
bzero(buf,42);
|
||||||
|
// No nullPointer-warning shall be shown:
|
||||||
|
// cppcheck-suppress bzeroCalled
|
||||||
|
bzero(s,n);
|
||||||
|
}
|
||||||
|
|
||||||
char * nullPointer_stpcpy(char *src, char *dest)
|
char * nullPointer_stpcpy(char *src, char *dest)
|
||||||
{
|
{
|
||||||
// No warning shall be shown:
|
// No warning shall be shown:
|
||||||
|
|
Loading…
Reference in New Issue