# fstack-protector

Enables or disables stack overflow security checks for certain (or all) routines.

## Syntax

Linux: | -fstack-protector[-keyword] -fno-stack-protector[-keyword]

macOS: | -fstack-protector[-keyword] -fno-stack-protector[-keyword]

Windows: | None

## Arguments

keyword | Possible values are:
strong | When option -fstack-protector-strong is specified, it enables stack overflow security checks for routines with any type of buffer.
all | When option -fstack-protector-all is specified, it enables stack overflow security checks for every routine.

If no -keyword is specified, option -fstack-protector enables stack overflow security checks for routines with a string buffer.

## Default

-fno-stack-protector, -fno-stack-protector-strong | No stack overflow security checks are enabled for the relevant routines.
-fno-stack-protector-all | No stack overflow security checks are enabled for any routines.

## Description

This option enables or disables stack overflow security checks for certain (or all) routines. A stack overflow occurs when a program stores more data in a variable on the execution stack than is allocated to the variable. Writing past the end of a string buffer or using an index for an array that is larger than the array bound could cause a stack overflow and security violations.

The -fstack-protector options are provided for compatibility with gcc. They use the gcc/glibc implementation when possible. If the gcc/glibc implementation is not available, they use the Intel implementation.

For an Intel-specific version of this feature, see option -fstack-security-check.

## IDE Equivalent

None

## Alternate Options

None

Parent topic: Data Options

## See Also

fstack-security-check compiler option
GS compiler option