std.cfg: Take the return value from fread() into account.

This commit is contained in:
orbitcowboy 2017-02-02 13:33:06 +01:00
parent ae444d7e78
commit 9cb0941df2
2 changed files with 4 additions and 3 deletions

View File

@ -1058,6 +1058,7 @@
<!-- size_t fread(void *ptr, size_t size, size_t nobj, FILE *stream); -->
<function name="fread,std::fread">
<noreturn>false</noreturn>
<use-retval/>
<leak-ignore/>
<arg nr="1">
<not-null/>

View File

@ -48,12 +48,12 @@ void bufferAccessOutOfBounds(void)
// cppcheck-suppress bufferAccessOutOfBounds
// cppcheck-suppress redundantCopy
strncpy(a,"abcde",6);
fread(a,1,5,stdin);
(void)fread(a,1,5,stdin);
// cppcheck-suppress bufferAccessOutOfBounds
fread(a,1,6,stdin);
(void)fread(a,1,6,stdin);
fwrite(a,1,5,stdout);
// cppcheck-suppress bufferAccessOutOfBounds
fread(a,1,6,stdout);
(void)fread(a,1,6,stdout);
}
// memory leak