fstack-security-check, GS

Causes the compiler to detect some buffer overruns.

IDE Equivalent

Windows: C/C++ > Code Generation > Buffer Security Check

Linux: None

Mac OS: None

Architectures

IA-32 architecture, Intel® 64 architecture

Syntax

Linux and Mac OS: -fstack-security-check
  -fno-stack-security-check
Windows:    /GS
     /GS-

Arguments

None

Default

/GS-      The compiler does not detect buffer overruns.
-fno-stack-security-check      The compiler does not detect buffer overruns.

Description

This option causes the compiler to generate code that detects some buffer overruns that overwrite the return address; this is a common technique for exploiting code that does not enforce buffer size restrictions. The /GS option is supported with Microsoft Visual Studio .NET 2003* and Microsoft Visual Studio 2005*.

Alternate Options

None