Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: REM Cost Reform

...

The behavior of a program is undefined when it uses the value of a pointer to a FILE object after the associated file is closed (see undefined behavior 148153.) Programs that close the standard streams (especially stdout but also stderr and stdin) must be careful not to use the stream objects in subsequent function calls, particularly those that implicitly operate on such objects (such as printf(), perror(), and getc()).

...

Failing to properly close files may allow unintended access to, or exhaustion of, system resources.

Rule

Severity

Likelihood

Detectable

Remediation Cost

Repairable

Priority

Level

FIO22-C

Medium

Unlikely

Medium

No

No

P4

P2

L3

Automated Detection

Tool

Version

Checker

Description

Compass/ROSE
   

Fortify SCA

5.0

 Can detect violations of this rule with CERT C Rule Pack



Klocwork
Include Page
Klocwork_V
Klocwork_V

RH.LEAK

 

LDRA tool suite
Include Page
LDRA_V
LDRA_V

49 D

Fully implemented
Partially implemented
Parasoft C/C++test

Include Page
Parasoft_V
Parasoft_V

CERT_C-FIO22-a

Ensure resources are freed

Related Vulnerabilities

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

Related Guidelines

Bibliography

[Dowd 2006]Chapter 10, "UNIX Processes" ("File Descriptor Leaks," pp. 582–587)
[IEEE Std 1003.1:2013]XSH, System Interfaces, open
[MSDN]Inheritance (Windows)
[NAI 1998]
 

...



...

Image Modified Image Modified Image Modified