Versions Compared

Key

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

...

  • ISO/IEC 9899:2011 ISO/IEC, Programming Languages—C, 3rd ed. [ISO/IEC 9899:2011]
  • ISO/IEC 9899:2011/Cor.1:2012, Technical Corrigendum 1

...

Most guidelines have a noncompliant code example that is a C11-conforming program to ensure that the problem identified by the guideline is within the scope of the standard. However, the best solutions to secure coding problems are often platform specific. In many cases, this standard provides appropriate compliant solutions for both POSIX and Windows operating systems. Language and library extensions that have been published as ISO/IEC technical reports or technical specifications are frequently given precedence, such has as those described by ISO/IEC TR 24731-2, Extensions to the C Library—Part II: Dynamic Allocation Functions [ ISO/IEC TR 24731-2:2010 ]. In many cases, compliant solutions are also provided for specific platforms such as Linux or OpenBSD. Occasionally, interesting or illustrative implementation-specific behaviors are described.

...

The C Standard documents existing practice where possible. That is, most features must be tested in an an  implementation before being included in the standard. The CERT C Coding Standard has a different purpose: to establish a set of best practices, which sometimes requires introducing new practices that may not be widely known or used when existing practices are inadequate. To put it a different way, the CERT C Coding Standard attempts to drive change rather than just document it.

For example, the optional but normative Annex K, "Bounds“Bounds-Checking Interfaces," introduced in C11, is gaining support but at present is implemented by only a few vendors. It introduces functions such as memcpy_s(), which serve the purpose of security by adding the destination buffer size to the API. A forward-looking document could not reasonably ignore these functions simply because they are not yet widely implemented. The base C Standard is more widely implemented than Annex K, but even if it were not, it is the direction in which the industry is moving. Developers of new C code, especially, need guidance that is usable, on and makes the best use of, the compilers and tools that are now being developed and are being supported into the future.

...

In general, the CERT coding standards try to avoid the inclusion of controversial rules that lack a broad consensus.01. Introduction01. IntroductionImage Removed