# FORTIFY\_SOURCE

DevFeed: [FORTIFY\_SOURCE](<https://devfeed.tech/articles/fortify-source-38928.md>)

Original publisher: [Read original article](<https://idea.popcount.org/2013-08-15-fortify_source>)

Author: Marek

Published: 2013-08-14T22:00:00Z

Content type: tutorial

Language: en

Sources: [Marek Majkowski](<https://devfeed.tech/sources/marek-majkowski.md>)

Topics: [C](<https://devfeed.tech/topics/c.md>), [gcc](<https://devfeed.tech/topics/gcc.md>), [Security](<https://devfeed.tech/topics/security.md>), [Linux](<https://devfeed.tech/topics/linux.md>), [Fedora](<https://devfeed.tech/topics/fedora.md>), [Ubuntu](<https://devfeed.tech/topics/ubuntu.md>)

Tags: [buffer-overflow](<https://devfeed.tech/tags/buffer-overflow.md>), [c](<https://devfeed.tech/tags/c.md>), [fedora](<https://devfeed.tech/tags/fedora.md>), [gcc](<https://devfeed.tech/tags/gcc.md>), [linux](<https://devfeed.tech/tags/linux.md>), [performance](<https://devfeed.tech/tags/performance.md>), [protection](<https://devfeed.tech/tags/protection.md>), [security](<https://devfeed.tech/tags/security.md>), [ubuntu](<https://devfeed.tech/tags/ubuntu.md>)

## AI overview

This tutorial explains two GCC security options used by C programmers on Linux distributions: -fstack-protector and -D_FORTIFY_SOURCE=2. It shows how stack canaries detect stack corruption and how fortified buffer functions can help detect some overflows, while noting performance costs and the need for safer coding practices.

## Source excerpt

FORTIFY_SOURCE In recent years Linux distributions started treating security more seriously. Out of many security features two are directly affecting C programmers: and . These GCC options are now enabled by default on Ubuntu and Fedora. What do these options do?