ISO/IEC TS 17961:2013 情報技術—プログラミング言語、その環境、およびシステムソフトウェアインターフェイス—Cの安全なコーディングルール | ページ 4

※一部、英文及び仏文を自動翻訳した日本語訳を使用しています。

1 スコープ

この技術仕様では次のことを指定します

  • C プログラミング言語での安全なコーディングのルールと
  • コード例。

この技術仕様では次のことは指定されていません

  • これらのルールが適用されるメカニズム、または
  • 強制する特定のコーディング スタイル。 (適切なスタイル ガイドラインについて合意を形成することは不可能でした。プログラマはスタイル ガイドラインを定義し、これらのガイドラインを一貫して適用する必要があります。コーディング スタイルを一貫して適用する最も簡単な方法は、コード フォーマット ツールを使用することです。多くの対話型開発環境では、そのようなものが提供されています。能力。)

この技術仕様の各ルールにはコード例が付いています。コード例は情報提供のみを目的としており、ルールの規範部分で概説されている要件を明確にするために役立ちます。例は規範的な要件を課しません。

C 標準で定義されている未定義の動作に基づくこの技術仕様の各ルールは、数値コードによって未定義の動作を識別します。未定義の動作の数値コードは、付録 B「未定義の動作」に記載されています。

2 種類の異なる例が提供されています。

  • 潜在的にセキュリティ上の影響を与える脆弱性をもつ言語構造を示す不適合。このような例は、影響を受ける言語構造の適合アナライザーから診断を導き出すことが期待されます。そして
  • 準拠したサンプルは診断を引き起こさないことが期待されます。

例は完全なプログラムを意図したものではありません。簡潔にするために、通常は、参照されるシンボルの宣言を提供するために必要となる C 標準ライブラリ ヘッダーの#includeディレクティブを省略します。定義が特定の弱点を示すために必須ではない場合、コード例では定義を提供せずにシンボルを宣言することもできます。

この技術仕様の一部の規則には例外があります。例外はこれらのルールの仕様の一部であり、規範的なものです。

1 Scope

This Technical Specification specifies

  • rules for secure coding in the C programming language and
  • code examples.

This Technical Specification does not specify

  • the mechanism by which these rules are enforced or
  • any particular coding style to be enforced. (It has been impossible to develop a consensus on appropriate style guidelines. Programmers should define style guidelines and apply these guidelines consistently. The easiest way to consistently apply a coding style is with the use of a code formatting tool. Many interactive development environments provide such capabilities.)

Each rule in this Technical Specification is accompanied by code examples. Code examples are informative only and serve to clarify the requirements outlined in the normative portion of the rule. Examples impose no normative requirements.

Each rule in this Technical Specification that is based on undefined behavior defined in the C Standard identifies the undefined behavior by a numeric code. The numeric codes for undefined behaviors can be found in Annex B, Undefined Behavior.

Two distinct kinds of examples are provided:

  • noncompliantexamples demonstrating language constructs that have weaknesses with potentially exploitable security implications; such examples are expected to elicit a diagnostic from a conforming analyzer for the affected language construct; and
  • compliant examples are expected not to elicit a diagnostic.

Examples are not intended to be complete programs. For brevity, they typically omit #include directives of C Standard Library headers that would otherwise be necessary to provide declarations of referenced symbols. Code examples may also declare symbols without providing their definitions if the definitions are not essential for demonstrating a specific weakness.

Some rules in this Technical Specification have exceptions. Exceptions are part of the specification of these rules and are normative.