Opening a file that is already open has implementation-defined behavior according , according to The the C Standard, subclause 7.21.3, paragraph 8 [ISO/IEC 9899:2011]:
Functions that open additional (nontemporary) files require a file name, which is a string. The rules for composing valid file names are implementation-defined. Whether the same file can be simultaneously open multiple times is also implementation-defined.
While some Some platforms may forbid a file simultaneously being opened multiple times, but platforms that allow it may facilitate dangerous race conditions.
...
Simultaneously opening a file multiple times can result in abnormal program termination or data integrity violations.
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
|---|---|---|---|---|---|
FIO31-C | mediumMedium | probableProbable | highHigh | P4 | L3 |
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Related Guidelines
| CERT C++ Secure Coding Standard | FIO31-CPP. Do not simultaneously open the same file multiple times |
| MITRE CWE | CWE-362, Race conditions CWE-675, Duplicate operations on resource |
...