Gentoo Archives: gentoo-commits

From: "Patrick Lauer (patrick)" <patrick@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-util/cvs/files: cvs-1.12.12-cvs-gnulib-vasnprintf.patch
Date: Sun, 01 Feb 2009 18:04:53
Message-Id: E1LTggY-0002yP-6w@stork.gentoo.org
1 patrick 09/02/01 18:04:46
2
3 Added: cvs-1.12.12-cvs-gnulib-vasnprintf.patch
4 Log:
5 Fixing cvs to work with gcc 4.3.3 which enables FORTIFY_SOURCES. Fixes #230849. Patch from Bruno Haible <bruno@×××××.org>, thanks to Magnus Granberg <zorry@×××.nu> for some hints and explanations.
6 (Portage version: 2.2_rc23/cvs/Linux x86_64)
7
8 Revision Changes Path
9 1.1 dev-util/cvs/files/cvs-1.12.12-cvs-gnulib-vasnprintf.patch
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-util/cvs/files/cvs-1.12.12-cvs-gnulib-vasnprintf.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-util/cvs/files/cvs-1.12.12-cvs-gnulib-vasnprintf.patch?rev=1.1&content-type=text/plain
13
14 Index: cvs-1.12.12-cvs-gnulib-vasnprintf.patch
15 ===================================================================
16 http://bugs.gentoo.org/213833
17
18 commit 913c09becd9df89dbd9b9f386e7f35c240d5efe8
19 Author: Bruno Haible <bruno@×××××.org>
20 Date: Fri Oct 19 01:50:42 2007 +0200
21
22 Don't use %n on glibc >= 2.3 systems.
23
24 diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
25 index f563823..5d818aa 100644
26 --- a/lib/vasnprintf.c
27 +++ b/lib/vasnprintf.c
28 @@ -3385,9 +3385,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
29 #endif
30 *p = dp->conversion;
31 #if USE_SNPRINTF
32 +# if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3))
33 p[1] = '%';
34 p[2] = 'n';
35 p[3] = '\0';
36 +# else
37 + /* On glibc2 systems from glibc >= 2.3 - probably also older
38 + ones - we know that snprintf's returns value conforms to
39 + ISO C 99: the gl_SNPRINTF_DIRECTIVE_N test passes.
40 + Therefore we can avoid using %n in this situation.
41 + On glibc2 systems from 2004-10-18 or newer, the use of %n
42 + in format strings in writable memory may crash the program
43 + (if compiled with _FORTIFY_SOURCE=2), so we should avoid it
44 + in this situation. */
45 + p[1] = '\0';
46 +# endif
47 #else
48 p[1] = '\0';
49 #endif