aboutsummaryrefslogtreecommitdiffstats
path: root/man7/feature_test_macros.7
diff options
context:
space:
mode:
authorMichael Kerrisk <mtk.manpages@gmail.com>2015-02-23 14:46:25 +0100
committerMichael Kerrisk <mtk.manpages@gmail.com>2015-03-02 17:22:25 +0100
commitef79705676b3fa19a243312f5ee36851306ee7d0 (patch)
tree038b2a1db0f188383009520456bef0a7a3313cde /man7/feature_test_macros.7
parentfe11933096ca8bca699e161b7d986c41414c00ec (diff)
downloadman-pages-ef79705676b3fa19a243312f5ee36851306ee7d0.tar.gz
feature_test_macros.7: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Diffstat (limited to 'man7/feature_test_macros.7')
-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,