C99 defines the {{Wiki Markup fwrite()}} function as follows \[ [ISO/IEC 9899:1999|AA. Bibliography#ISO/IEC 9899-1999]\]:
size_t fwrite(const void *restrict ptr, size_t size, size_t nitems, FILE *restrict stream);
The
fwrite()function shall write, from the array pointed to byptr, up tonitemselements whose size is specified bysize, to the stream pointed to bystream. For each object,sizecalls shall be made to thefputc()function, taking the values (in order) from an array of unsigned char exactly overlaying the object. The file-position indicator for the stream (if defined) shall be advanced by the number of bytes successfully written. If an error occurs, the resulting value of the file-position indicator for the stream is unspecified.
...
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
|---|---|---|---|---|---|
FIO18-C | Medium | Probable | Medium | P8 | L2 |
Related Guidelines
CERT C++ Secure Coding Standard: FIO18-CPP. Never expect write() to terminate the writing process at a null character
...