aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--man7/feature_test_macros.712
1 files changed, 12 insertions, 0 deletions
diff --git a/man7/feature_test_macros.7 b/man7/feature_test_macros.7
index eb9bb26c50..6cb73e9b92 100644
--- a/man7/feature_test_macros.7
+++ b/man7/feature_test_macros.7
@@ -479,6 +479,18 @@ With
.B _FORTIFY_SOURCE
set to 2 some more checking is added, but
some conforming programs might fail.
+.\" For example, given the following code
+.\" int d;
+.\" char buf[1000], buf[1000];
+.\" strcpy(fmt, "Hello world\n%n");
+.\" snprintf(buf, sizeof(buf), fmt, &d);
+.\"
+.\" Compiling with "gcc -D_FORTIFY_SOURCE=2 -O1" and then running will
+.\" cause the following diagnostic at runtime at the snprintf() call
+.\"
+.\" *** %n in writable segment detected ***
+.\" Aborted (core dumped)
+.\"
Some of the checks can be performed at compile time,
and result in compiler warnings;
other checks take place at run time,