std.cfg: Added overlappingWriteFunction check to wcscpy().

This commit is contained in:
orbitcowboy 2021-07-10 09:20:51 +02:00
parent a8fb0309fd
commit c38a43c353
2 changed files with 12 additions and 0 deletions

View File

@ -4805,6 +4805,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<returnValue type="wchar_t *"/>
<noreturn>false</noreturn>
<leak-ignore/>
<not-overlapping-data ptr1-arg="1" ptr2-arg="2" strlen-arg="2"/>
<arg nr="1" direction="out">
<not-null/>
</arg>

View File

@ -30,6 +30,17 @@
#include <functional>
#include <bitset>
wchar_t * overlappingWriteFunction_wcscpy(wchar_t *src, wchar_t *dest)
{
// No warning shall be shown:
(void)wcscpy(dest, src);
const wchar_t * destBuf = dest;
// TODO-cppcheck-suppress overlappingWriteFunction #10355
(void)wcscpy(dest, destBuf);
// cppcheck-suppress overlappingWriteFunction
return wcscpy(src, src);
}
wchar_t * overlappingWriteFunction_wcsncpy(wchar_t *buf, const std::size_t count)
{
// No warning shall be shown: