std.cfg: Added a overlappingWriteFunction-check to strncat
This commit is contained in:
parent
cbb07b6247
commit
e90a3053d4
|
@ -4916,6 +4916,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
|
||||||
<returnValue type="char *"/>
|
<returnValue type="char *"/>
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
|
<not-overlapping-data ptr1-arg="1" ptr2-arg="2" size-arg="3"/>
|
||||||
<arg nr="1" direction="inout">
|
<arg nr="1" direction="inout">
|
||||||
<not-null/>
|
<not-null/>
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
|
|
|
@ -93,6 +93,20 @@ char * overlappingWriteFunction_strcat(char *src, char *dest)
|
||||||
return strcat(src, src);
|
return strcat(src, src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char * overlappingWriteFunction_strncat(char *src, char *dest, const std::size_t count)
|
||||||
|
{
|
||||||
|
// No warning shall be shown:
|
||||||
|
(void)strncat(dest, src, 42);
|
||||||
|
(void)strncat(dest, src, count);
|
||||||
|
// cppcheck-suppress overlappingWriteFunction
|
||||||
|
(void)strncat(dest, dest+1, 2);
|
||||||
|
char buffer[] = "strncat";
|
||||||
|
// cppcheck-suppress overlappingWriteFunction
|
||||||
|
(void)strncat(buffer, buffer + 1, 3);
|
||||||
|
// TODO-cppcheck-suppress overlappingWriteFunction
|
||||||
|
return strncat(src, src, count);
|
||||||
|
}
|
||||||
|
|
||||||
wchar_t * overlappingWriteFunction_wcscpy(wchar_t *src, wchar_t *dest)
|
wchar_t * overlappingWriteFunction_wcscpy(wchar_t *src, wchar_t *dest)
|
||||||
{
|
{
|
||||||
// No warning shall be shown:
|
// No warning shall be shown:
|
||||||
|
|
Loading…
Reference in New Issue