c# - 由于互斥锁导致的不正确锁定漏洞?
问题描述
Checkmarx 定期扫描我的 windows 项目。
现在,我得到
“不当_锁定”
我认为由于错误的 Mutex 实现导致的漏洞。
下面是 Mutex 的代码片段:
Mutex TuningClientInstanceMutex;
/// <summary>
/// Method used to configure the inter process communication
/// </summary>
private void ConfigureInterProcessCommunication()
{
try
{
// Try to open existing mutex
Mutex.OpenExisting(Mutex_Name);
// Tuning Client must be already running
return;
}
catch (WaitHandleCannotBeOpenedException)
{
// Not implemented.
}
// Flag that the application is available to accept automated calls
// Create the mutex that will allow automated listeners to know that we have started
TuningClientInstanceMutex= new Mutex(true, Mutex_Name);
// Some other code is here.
// ..........
// ..........
}
public void Dispose()
{
if (TuningClientInstanceMutex!= null)
{
TuningClientInstanceMutex.Close();
}
}
我应该在这里改进什么来减轻“Improper_Locking”漏洞?
解决方案
推荐阅读
- javascript - 将多个对象作为 1d 传递到数组中
- docker - docker PUSH 命令中的“本地不存在带有标签的图像”错误
- imageresizer - ImageResizer 自动清理
- javascript - Adminlte 固定布局没有固定标题
- android - 在具有多个 ViewTypes 的 RecyclerView 中显示项目时出错
- javascript - Angularjs无法访问函数外的变量
- angular - ViewChild 未定义
- javascript - Javascript 获取实际的 url 来填写表格
- php - Woocommerce 电子邮件订单详细信息中的其他列和项目值
- javascript - 如何在javascript中将数组转换为特定对象?