Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 230849
Collapse All | Expand All

(-)a/lib/vasnprintf.c (+12 lines)
Lines 3385-3393 VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, Link Here
3385
#endif
3385
#endif
3386
		  *p = dp->conversion;
3386
		  *p = dp->conversion;
3387
#if USE_SNPRINTF
3387
#if USE_SNPRINTF
3388
# if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3))
3388
		p[1] = '%';
3389
		p[1] = '%';
3389
		p[2] = 'n';
3390
		p[2] = 'n';
3390
		p[3] = '\0';
3391
		p[3] = '\0';
3392
# else
3393
		/* On glibc2 systems from glibc >= 2.3 - probably also older
3394
		   ones - we know that snprintf's returns value conforms to
3395
		   ISO C 99: the gl_SNPRINTF_DIRECTIVE_N test passes.
3396
		   Therefore we can avoid using %n in this situation.
3397
		   On glibc2 systems from 2004-10-18 or newer, the use of %n
3398
		   in format strings in writable memory may crash the program
3399
		   (if compiled with _FORTIFY_SOURCE=2), so we should avoid it
3400
		   in this situation.  */
3401
		p[1] = '\0';
3402
# endif
3391
#else
3403
#else
3392
		p[1] = '\0';
3404
		p[1] = '\0';
3393
#endif
3405
#endif

Return to bug 230849