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.0p0 Hot Tips | CONFIDENTIAL | CodeSecure Inc |
メモリ保護を無効化する入力引数が関数に渡されています。
| クラス名 | Memory Protection Removal | ||||||
|---|---|---|---|---|---|---|---|
| 日本語クラス名 | メモリ保護の無効化 | ||||||
| クラス分類 | セキュリティ (security) | ||||||
| ニーモニック | MISC.MEM.PROT | ||||||
| カテゴリー |
|
||||||
| 対応言語 | C および C++ で利用可能です。 |
||||||
| 有効/無効設定 | このワーニングクラスのチェックはデフォルトで無効になっています。チェックを有効にするにはプロジェクト設定ファイル
(configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += allow class="Memory Protection Removal" |
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/mman.h>
int map_memory (int infd, void *mybuf)
{
char *src, *dst;
struct stat statbuf;
if (fstat (infd, &statbuf) < 0) return -1;
src = mmap (mybuf, /* Memory Protection Removal warning issued here */
statbuf.st_size,
PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_SHARED,
infd,
0);
if (src == MAP_FAILED) return -1;
exit(0);
}
CodeSonar ships with library models that allow it to functions such as libc mmap() and Win32 VirtualAlloc() that can set memory permission. If one of these functions is called with a problematic value in the relevant parameter position, a warning will be issued.
If you have created a custom library model for some function f() in terms of one of these existing models, calls to f() will also be capable of triggering Memory Protection Removal warnings.
設定ファイルの以下のパラメータがこのワーニングクラスのチェックに影響します。