C and C++ Binaries


BADFUNC.MEMCMP : memcmpの使用

要旨

A use of memcmp(), which if used on some types, might compare the vtable pointer or padding bits in between fields.

プロパティ

クラス名 Use of memcmp
日本語クラス名 memcmpの使用
クラス分類 セキュリティ (security)
ニーモニック BADFUNC.MEMCMP
カテゴリー
MisraC++2023 MisraC++2023:24.5.2 The C++ Standard Library functions memcpy, memmove and memcmp from <cstring> shall not be used
CERT-C CERT-C:EXP42-C Do not compare padding data
CERT-CPP CERT-CPP:EXP62-CPP Do not access the bits of an object representation that are not part of the object's value representation
  CERT-CPP:OOP57-CPP Prefer special member functions and overloaded operators to C Standard Library functions
対応言語 C および C++ で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで無効になっています。チェックを有効にするにはプロジェクト設定ファイル (configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += allow class="Use of memcmp"

Resolution

Compare fields individually.

関連のある設定ファイルパラメータ

このクラスは一般テンプレート設定ファイルで BAD_FUNCTION_* ルールセットによって実装されています。

設定ファイルの以下のパラメータがこのワーニングクラスのチェックに影響します。