...
| Code Block | ||||
|---|---|---|---|---|
| ||||
char *file_name; FILE *file; /* initializeInitialize file_name */ file = fopen(file_name, "w+"); if (file == NULL) { /* Handle error condition */ } /* ... */ if (remove(file_name) != 0) { /* Handle error condition */ } /* continueContinue performing I/O operations on file */ fclose(file); |
...
Calling remove() on an open file has different implications for different implementations and may cause abnormal termination if the removed file is written to or read from, or it may result in unintended information disclosure from files not deleted as intended.
...
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Related Guidelines
...
ISO/IEC 9899:2011 Section 7.21.4.1, "The remove function"
Bibliography
...