posix.cfg: Fixed bufferAccessOutOfBounds falsen negative for strnlen() and added a TODO for wcsnlen()
This commit is contained in:
parent
dad1a68e51
commit
3bd65d42cd
|
@ -4723,6 +4723,7 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
|
||||||
<arg nr="1" direction="in">
|
<arg nr="1" direction="in">
|
||||||
<not-null/>
|
<not-null/>
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
|
<minsize type="argvalue" arg="2"/>
|
||||||
</arg>
|
</arg>
|
||||||
<arg nr="2" direction="in">
|
<arg nr="2" direction="in">
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
|
|
|
@ -48,6 +48,15 @@ int nullPointer_wcsnlen(const wchar_t *s, size_t n)
|
||||||
return wcsnlen(s, n);
|
return wcsnlen(s, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t bufferAccessOutOfBounds_wcsnlen(const wchar_t *s, size_t maxlen)
|
||||||
|
{
|
||||||
|
wchar_t buf[2]={L'4',L'2'};
|
||||||
|
size_t len = wcsnlen(buf,2);
|
||||||
|
// TODO cppcheck-suppress bufferAccessOutOfBounds
|
||||||
|
len+=wcsnlen(buf,3);
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
int nullPointer_gethostname(char *s, size_t n)
|
int nullPointer_gethostname(char *s, size_t n)
|
||||||
{
|
{
|
||||||
// cppcheck-suppress nullPointer
|
// cppcheck-suppress nullPointer
|
||||||
|
@ -272,6 +281,23 @@ void bufferAccessOutOfBounds_bzero(void *s, size_t n)
|
||||||
bzero(s,n);
|
bzero(s,n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t bufferAccessOutOfBounds_strnlen(const char *s, size_t maxlen)
|
||||||
|
{
|
||||||
|
char buf[2]={'4','2'};
|
||||||
|
size_t len = strnlen(buf,2);
|
||||||
|
// cppcheck-suppress bufferAccessOutOfBounds
|
||||||
|
len+=strnlen(buf,3);
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t nullPointer_strnlen(const char *s, size_t maxlen)
|
||||||
|
{
|
||||||
|
// No warning shall be shown:
|
||||||
|
(void) strnlen(s, maxlen);
|
||||||
|
// cppcheck-suppress nullPointer
|
||||||
|
return strnlen(NULL, maxlen);
|
||||||
|
}
|
||||||
|
|
||||||
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