SHA256
3
0
forked from pool/glibc
glibc/glibc-2.14-32args-printf.patch

25 lines
967 B
Diff

# patch to fix printf when register_printf_function is in use and the format to
# printf contains more than 64 elements.
#
# extend_alloca modifies nspecs_max (2nd arg) with the size of the space, not the
# number of elements. Use a temporary to store the return value. Explicitly set the correct size.
#
# bnc#733140
#
# Rich Coe (rcoe@wi.rr.com)
#
--- stdio-common/vfprintf.c.orig 2011-11-28 11:53:32.937976831 -0600
+++ stdio-common/vfprintf.c 2011-11-28 16:07:35.546839533 -0600
@@ -1683,8 +1683,10 @@ do_positional:
{
/* Extend the array of format specifiers. */
struct printf_spec *old = specs;
- specs = extend_alloca (specs, nspecs_max,
+ size_t nsize = nspecs_max;
+ specs = extend_alloca (specs, nsize,
2 * nspecs_max * sizeof (*specs));
+ nspecs_max = 2 * nspecs_max;
/* Copy the old array's elements to the new space. */
memmove (specs, old, nspecs * sizeof (struct printf_spec));