C and C++


LANG.CAST.VARARG : 可変長引数関数のキャスト

要旨

可変長引数を持つ関数ポインタが、異なるパラメータや戻り値型の関数ポインタにキャストされています。

プロパティ

クラス名 Varargs Function Cast
日本語クラス名 可変長引数関数のキャスト
クラス分類 セキュリティ (security)
ニーモニック LANG.CAST.VARARG
カテゴリー
AUTOSARC++14 AUTOSARC++14:M8-4-4 A function identifier shall either be used to call the function or it shall be preceded by &.
MisraC++2008 MisraC++2008:8-4-4 A function identifier shall either be used to call the function or it shall be preceded by &.
CWE CWE:704 Incorrect Type Conversion or Cast
JSF++ JSF++:183 Every possible measure should be taken to avoid type casting.
対応言語 C および C++ で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで有効になっています。チェックを無効にするにはプロジェクト設定ファイル (configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += discard class="Varargs Function Cast"

typedef void (*va_t)(int, ...);
void E( int i, int j ) {}

int main( void ) {
  va_t va = (va_t)E;  /* 'Varargs Function Cast' warning issued here */

   va(1,2,3);
   return 42;
}

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

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