Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: cleaned up some stuff

...

Code Block
bgColor#FFcccc
langc
#include <stdio.h>
 
int close_stdin(void) {
  if (fclose(stdin) == 0) {
    return -1;
  }
  else {
    printf("stdin successfully closed.\n");
  }
  return 0;
}

 

Compliant Solution

In this compliant solution, stdin is not used again after it is closed.  This must remain true for the remainder of the program. 

...

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

FIO42FIO46-C

Medium

Unlikely

Medium

P4

L3

...

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

Related Guidelines

 

Bibliography

[IEEE Std 1003.1:2013]XSH, System Interfaces, open
[ISO/IEC 9899:2011

Subclause 7.21.3, "Files"

Subclause 7.21.5.1, "The fclose Function"

 

...