JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.

If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.

If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.

CodeSonar® 9.2p0 CONFIDENTIAL CodeSecure Inc
C and C++
Binaries


LANG.STRUCT.DBG : 残ったデバッグコード

要旨

出力関数を使用したデバッグトレース文が意図せずコード中に残っている可能性があります。

このクラスは <stdio.h>入出力関数の使用 の部分集合となります。

プロパティ

クラス名 Leftover Debug Code
日本語クラス名 残ったデバッグコード
クラス分類 スタイル (style)
ニーモニック LANG.STRUCT.DBG
カテゴリー
CWE CWE:489 Active Debug Code
  CWE:1295 Debug Messages Revealing Unnecessary Information
対応言語 C および C++ で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで無効になっています。チェックを有効にするにはプロジェクト設定ファイル (configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += allow class="Leftover Debug Code"

#include <fcntl.h>
#include <stdio.h>
int lang_struct_dbg(void){
    int ret;
    char filepath[256];
     
    ret = open("/usr/files/info.txt", O_RDONLY);
    if (!ret){
        puts("can't open info.txt"); /* 'Leftover Debug Code' warning issued here */
    }
    return ret;
}

解決法

このワーニングが発生した場合、出力関数によってユーザーが見るべきではない情報が出力されていないことを確認してください。
問題がないことを確認できた場合は、ワーニングの stateSuppressed (抑制)に変更して除外することができます。

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

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

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

 

To report problems with this documentation, please visit https://support.codesecure.com/.