Add missing tests for strncpy

Add tests for verifying that the bufferoverrun tests are correct.
This commit is contained in:
versat 2017-12-11 10:25:59 +01:00
parent d63897ff21
commit cc435c3e92
1 changed files with 5 additions and 0 deletions

View File

@ -48,6 +48,11 @@ void bufferAccessOutOfBounds(void)
// cppcheck-suppress bufferAccessOutOfBounds // cppcheck-suppress bufferAccessOutOfBounds
// cppcheck-suppress redundantCopy // cppcheck-suppress redundantCopy
strncpy(a,"abcde",6); strncpy(a,"abcde",6);
// cppcheck-suppress bufferAccessOutOfBounds
// cppcheck-suppress redundantCopy
strncpy(a,"a",6);
// cppcheck-suppress redundantCopy
strncpy(a,"abcdefgh",4);
fread(a,1,5,stdin); fread(a,1,5,stdin);
// cppcheck-suppress bufferAccessOutOfBounds // cppcheck-suppress bufferAccessOutOfBounds
fread(a,1,6,stdin); fread(a,1,6,stdin);