|
Lines 560-568
Link Here
|
| 560 |
} |
560 |
} |
| 561 |
*p = dp->conversion; |
561 |
*p = dp->conversion; |
| 562 |
#if USE_SNPRINTF |
562 |
#if USE_SNPRINTF |
| 563 |
p[1] = '%'; |
563 |
#if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) |
| 564 |
p[2] = 'n'; |
564 |
p[1] = '%'; |
| 565 |
p[3] = '\0'; |
565 |
p[2] = 'n'; |
|
|
566 |
p[3] = '\0'; |
| 567 |
#else |
| 568 |
/* On glibc2 systems from glibc >= 2.3 - probably also older |
| 569 |
ones - we know that snprintf's returns value conforms to |
| 570 |
ISO C 99: the gl_SNPRINTF_DIRECTIVE_N test passes. |
| 571 |
Therefore we can avoid using %n in this situation. |
| 572 |
On glibc2 systems from 2004-10-18 or newer, the use of %n |
| 573 |
in format strings in writable memory may crash the program |
| 574 |
(if compiled with _FORTIFY_SOURCE=2), so we should avoid it |
| 575 |
in this situation. */ |
| 576 |
p[1] = '\0'; |
| 577 |
#endif |
| 566 |
#else |
578 |
#else |
| 567 |
p[1] = '\0'; |
579 |
p[1] = '\0'; |
| 568 |
#endif |
580 |
#endif |