elf: Fix alloca size in _dl_debug_vdprintf
commiteef17d4d9fcd38c5cbb9bc9515ba72d1773b67a2
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Tue, 11 Oct 2022 13:22:35 +0000 (11 14:22 +0100)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Fri, 28 Oct 2022 10:16:09 +0000 (28 11:16 +0100)
treeb7b53fe307a94d583aa7681a7b0d7653c45a3e02
parent68619ddb3b7e8b64a6b849e4972e67163f7659c3
elf: Fix alloca size in _dl_debug_vdprintf

The alloca size did not consider the optional width parameter for
padding which could cause buffer underflow. The width is currently used
e.g. by _dl_map_object_from_fd which passes 2 * sizeof(void *) which
can be larger than the alloca buffer size on targets where
sizeof(void *) >= 2 * sizeof(unsigned long).

Even if large width is not used on existing targets it is better to fix
the formatting code to avoid surprises.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
elf/dl-printf.c