Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The only solution for mitigating ambiguity of a file, such as my_libraryOLD.h, is to rename old files with either a prefix (that would fall within the first eight characters) or add an extension (such as my_library.h.old).

Exceptions

PRE08-C-EX1: Although the C Standard requires only the first eight characters in the file name to be significant, most modern systems have long file names, and compilers on such systems can typically differentiate them. Consequently, long file names in headers may be used, provided that all the implementations to which the code is ported can distinguish between these file names.

...

Failing to guarantee uniqueness of header files may result in the inclusion of an older version of a header file, which may include incorrect macro definitions or obsolete function prototypes or result in other errors that may or may not be detected by the compiler. Portability issues may also stem from the use of header names that are not guaranteed to be unique.

Recommendation

Severity

Likelihood

Remediation Cost

Priority

Level

PRE08-C

Low

Unlikely

Medium

P2

L3

Automated Detection

ToolVersionCheckerDescription
ECLAIR
Axivion Bauhaus Suite

Include Page

ECLAIR

Axivion Bauhaus Suite_V

ECLAIR

Axivion Bauhaus Suite_V

CC2.
CertC-PRE08
Fully implemented

ECLAIR

Klocwork

Include Page
Klocwork
ECLAIR_V
Klocwork
ECLAIR_V

IF_DUPL_HEADER

 PRQA QA-C Include PagePRQA QA-C_vPRQA QA-C_vSecondary AnalysisFully implemented

CC2.PRE08

Fully implemented

Helix QAC

Include Page
Helix QAC_V
Helix QAC_V

C5002

Related Vulnerabilities

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

Related Guidelines

Bibliography

[ISO/IEC 9899:2011]Subclause 6.10.2, "Source File Inclusion"

...


...

Image Modified Image Modified Image Modified