C++ Visual Studio 中的安全开发生命周期检查选项是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18304632/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is Security Development Lifecycle Checks option in Visual Studio?
提问by Neil Kirk
I am using Visual Studio 2013 Preview, although I'm sure I've seen it in earlier versions. When creating a new project using the wizard, I select C++, Win32 Console Application, and there is an option to enable Security Development Lifecycle Checks on my project. Could someone explain exactly what this option does to my code/project?
我正在使用 Visual Studio 2013 预览版,尽管我确定我在早期版本中见过它。使用向导创建新项目时,我选择 C++、Win32 控制台应用程序,并且有一个选项可以在我的项目上启用安全开发生命周期检查。有人可以解释一下这个选项对我的代码/项目有什么作用吗?
采纳答案by MSalters
The /sdl
switch is described here. It turns some warnings into errors, which does not affect your code. Furthermore, it applies the /GS
check more aggresively.
此处/sdl
描述了该开关。它将一些警告转换为错误,这不会影响您的代码。此外,它/GS
更积极地应用检查。
Don't expect too much from it. The Microsoft SDL is really a workaround for 1980's style C programming. Even it you use 20th century C++, you don't need it. E.g. operator+(std::string, std::string)
is both safe and portable. Microsoft's SDL solution here in contrast is not portable, nor is it safe - the idea behind /GS
is to find errors with C string handling at runtime and abort the program, limiting the consequences but not making it safe.
不要对它期望太多。Microsoft SDL 确实是 1980 年代风格 C 编程的一种变通方法。即使你使用 20 世纪的 C++,你也不需要它。例如operator+(std::string, std::string)
既安全又便携。相比之下,微软的 SDL 解决方案不可移植,也不安全——背后的想法/GS
是在运行时发现 C 字符串处理的错误并中止程序,限制后果但不使其安全。
回答by Mohammad Izady
The Microsoft Security Development Lifecycle is a software development process used and proposed by Microsoft to reduce software maintenance costs and increase reliability of software concerning software security related bugs.
Microsoft 安全开发生命周期是 Microsoft 使用和提出的软件开发过程,用于降低软件维护成本并提高软件在与软件安全相关错误方面的可靠性。
These may helpful:
这些可能有帮助:
http://msdn.microsoft.com/en-us/library/windows/desktop/84aed186-1d75-4366-8e61-8d258746bopq.aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/84aed186-1d75-4366-8e61-8d258746bopq.aspx