• Skip to main content
  • assistive.skiplink.to.breadcrumbs
  • assistive.skiplink.to.header.menu
  • assistive.skiplink.to.action.menu
  • assistive.skiplink.to.quick.search
Log in
Confluence
  • Spaces
  • Hit enter to search
  • Help
    • Online Help
    • Keyboard Shortcuts
    • Feed Builder
    • What’s new
    • Available Gadgets
    • About Confluence
  • Log in

SEI CERT C++ Coding Standard
SEI CERT C++ Coding Standard
  • Pages
  • Boards

Space shortcuts

  • Dashboard
  • Secure Coding Home
  • Android
  • C
  • C++
  • Java
  • Perl

Page tree

Browse pages
    • Attachments (0)
    • Page History
    • Page Information
    • Resolved comments
    • View in Hierarchy
    • View Source
    • Export to PDF
    • Export to Word
  1. Pages
  2. SEI CERT C++ Coding Standard
  3. 2 Rules
  • Jira links

Rule 07. Input Output (FIO)

  • Created by Aaron Ballman, last modified by David Svoboda on Mar 15, 2022

  • Page:
    FIO50-CPP. Do not alternately input and output from a file stream without an intervening positioning call
  • Page:
    FIO51-CPP. Close files when they are no longer needed

 

The following rules from the SEI CERT C Coding Standard also apply in C++:

  • Page:
    FIO30-C. Exclude user input from format strings
  • Page:
    FIO32-C. Do not perform operations on devices that are only appropriate for files
  • Page:
    FIO34-C. Distinguish between characters read from a file and EOF or WEOF
  • Page:
    FIO37-C. Do not assume that fgets() or fgetws() returns a nonempty string when successful
  • Page:
    FIO38-C. Do not copy a FILE object
  • Page:
    FIO39-C. Do not alternately input and output from a stream without an intervening flush or positioning call
  • Page:
    FIO40-C. Reset strings on fgets() or fgetws() failure
  • Page:
    FIO41-C. Do not call getc(), putc(), getwc(), or putwc() with a stream argument that has side effects
  • Page:
    FIO42-C. Close files when they are no longer needed
  • Page:
    FIO44-C. Only use values for fsetpos() that are returned from fgetpos()
  • Page:
    FIO45-C. Avoid TOCTOU race conditions while accessing files
  • Page:
    FIO46-C. Do not access a closed file
  • Page:
    FIO47-C. Use valid format strings

Information for Editors
To have a new guideline automatically listed above be sure to label it fio and rule.

Risk Assessment Summary

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

FIO50-CPPLowLikelyMedium

P6

L2

FIO51-CPPMediumUnlikelyMedium

P4

L3

 


 

  • rule-list
  • rule
  • fio
  • section
Overview
Content Tools
  • Powered by Atlassian Confluence 8.5.21
  • Printed by Atlassian Confluence 8.5.21
  • Report a bug
  • Atlassian News
Atlassian

Carnegie Mellon University
Software Engineering Institute
4500 Fifth Avenue
Pittsburgh, PA 15213-2612
412-268-5800

Contact Us
  • Office Locations|
  • Additional Sites Directory|
  • Legal|
  • Privacy Notice|
  • CMU Ethics Hotline|
  • www.sei.cmu.edu

©2023 Carnegie Mellon University

{"serverDuration": 107, "requestCorrelationId": "c1201b5ff80f650d"}