Enhance application security with FORTIFY_SOURCE | Red Hat Security
“The FORTIFY_SOURCE macro provides lightweight support for detecting buffer overflows in various functions that perform operations on memory and strings. Not all types of buffer overflows can be detected with this macro, but it does provide an extra level of validation for some functions that are potentially a source of buffer overflow flaws. It protects both C and C++ code. FORTIFY_SOURCE works by computing the number of bytes that are going to be copied from a source to the destination. In case an attacker tries to copy more bytes to overflow a buffer, the execution of the program is stopped, and the following exception is returned:
See the entire article here: Enhance application security with FORTIFY_SOURCE | Red Hat Security.
Join the Red Hat Developer Program (it’s free) and get access to related cheat sheets, books, and product downloads.