Add more security in Visual Studio 2012

本文详细介绍了在 Visual Studio Code 中配置安全编码规范和使用相关工具进行代码分析的方法,包括编译选项、链接器选项、注册表设置等,以确保软件开发过程中的安全性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  • Compile flags:
    • /GS: Stack protection from buffer overrun.
    • /SDL: Subset of W3&W4 security warnings as errors.
    • Use warning 4.
    • /WX: Treat Warnings As Errors.
  • Linker flags:
    • /DYNAMICBASE: Randomize module base address to ensure that our code is at different location each time it is loaded.
    • /NXCOMPAT: Data Execution Prevention to ensure that data is difficult to execute.
    • /SAFESEH: Secure Exception Handling. Project->Properties->Linker->Advanced->Image has Safe Exception Handlers.
  • Using VS Code Analysis to find vulnerability.
  • Including Banned.h in projects to find unsafe methods which are listed in Banned.h.
  • Using BannedAPIextension to flag banned api use in editor. (only available for VS2010)
  • Enable /SEHOP in registry setting:
      1. Click Start, click Run, type regedit, and then press ENTER.
      2. Locate the following registry subkey:
        HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel\DisableExceptionChainValidation
        Note If you cannot find the DisableExceptionChainValidation registry entry under the
        HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel\
        subkey, follow these steps to create it:
        1. Right-click kernel, point to New, and then click DWORD Value.
        2. Type DisableExceptionChainValidation, and then press ENTER.
      3. Double-click DisableExceptionChainValidation.
      4. Change the value of the DisableExceptionChainValidation registry entry to 0 to enable it, and then click OK

        Note A value of 1 disables the registry entry. A value of 0 enables it.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值