海湾合作委员会
在gcc(man gcc
)上通过以下方式启用检查
-fstack-protector
Emit extra code to check for buffer overflows, such as stack smashing attacks. >This is done by adding a guard variable to functions with
vulnerable objects. This includes functions that call alloca, and functions with >buffers larger than 8 bytes. The guards are initialized when
a function is entered and then checked when the function exits. If a guard check >fails, an error message is printed and the program exits.
-fstack-protector-all
Like -fstack-protector except that all functions are protected.
您可以通过no-
在选项名称前加前缀来禁用两者
-fno-stack-protector -fno-stack-protector-all
LLVM / C语
在LLVM / Clang(http://clang.llvm.org/docs/UsersManual.html#commandline)上启用/禁用AdressSanitizer:
-f [no-] address-sanitizer:打开内存错误检测器AddressSanitizer。
和SAFECode(http://safecode.cs.illinois.edu/docs/UsersGuide.html)
-f [无]内存安全