Fortify Source

Back

The _FORTIFY_SOURCE macro adds compiler time and run time checks for buffer overflows and memory sanity.

gcc -o test test.c -D_FORTIFY_SOURCE=2

Available levels

_FORTIFY_SOURCE=1 _FORTIFY_SOURCE=2 _FORTIFY_SOURCE=3 emits code to check buffer overflows at runtime

At higher levels of fortify source there is a penalty on build size and performance.

References