summaryrefslogtreecommitdiffstats
path: root/m4-1.4.10-snprintf.patch
diff options
context:
space:
mode:
authorvcrhonek <vcrhonek@fedoraproject.org>2007-12-17 15:39:39 +0000
committervcrhonek <vcrhonek@fedoraproject.org>2007-12-17 15:39:39 +0000
commitd38a411beb42dddc59ebddad0f67d76680afbca6 (patch)
treeb69310930590c7a0408d5b8ecd8d7489dcfaf0c7 /m4-1.4.10-snprintf.patch
parent02d59253efabe90affa8194fb5b5808ba86dc877 (diff)
downloadm4-1_4_10-2_fc9.tar.gz
m4-1_4_10-2_fc9.tar.xz
m4-1_4_10-2_fc9.zip
fix vasnprintf puts %%n into a writeable format string in all casesm4-1_4_10-2_fc9
Diffstat (limited to 'm4-1.4.10-snprintf.patch')
-rw-r--r--m4-1.4.10-snprintf.patch25
1 files changed, 25 insertions, 0 deletions
diff --git a/m4-1.4.10-snprintf.patch b/m4-1.4.10-snprintf.patch
new file mode 100644
index 0000000..29f86bb
--- /dev/null
+++ b/m4-1.4.10-snprintf.patch
@@ -0,0 +1,25 @@
+--- m4-1.4.10/lib/vasnprintf.c_old 2007-07-05 13:48:27.000000000 +0200
++++ m4-1.4.10/lib/vasnprintf.c 2007-12-13 13:38:39.000000000 +0100
+@@ -3385,10 +3385,22 @@
+ #endif
+ *fbp = dp->conversion;
+ #if USE_SNPRINTF
++#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3))
+ fbp[1] = '%';
+ fbp[2] = 'n';
+ fbp[3] = '\0';
+ #else
++ /* On glibc2 systems from glibc >= 2.3 - probably also older
++ ones - we know that snprintf's returns value conforms to
++ ISO C 99: the gl_SNPRINTF_DIRECTIVE_N test passes.
++ Therefore we can avoid using %n in this situation.
++ On glibc2 systems from 2004-10-18 or newer, the use of %n
++ in format strings in writable memory may crash the program
++ (if compiled with _FORTIFY_SOURCE=2), so we should avoid it
++ in this situation. */
++ fbp[1] = '\0';
++#endif
++#else
+ fbp[1] = '\0';
+ #endif
+