]> git.ipfire.org Git - thirdparty/glibc.git/commit
stdlib: Fix __libc_message_impl iovec size (BZ 32947)
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 25 Jun 2025 19:33:24 +0000 (16:33 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 30 Jun 2025 16:51:41 +0000 (13:51 -0300)
commiteeb7b079d5d8785e760ca08c3692ffa579bbb737
treec197ad057102d5f25a97fd0ba2e7424657076e1b
parent681a24ae4d0cb8ed92de98b4da660308840b09ba
stdlib: Fix __libc_message_impl iovec size (BZ 32947)

The iovec size should account for all substrings between each conversion
specification.  For the format:

  "abc %s efg"

The list of substrings are:

  ["abc ", arg, " efg]

which is 2 times the number of maximum arguments *plus* one.

This issue triggered 'out of bounds' errors by stdlib/tst-bz20544 when
glibc is built with experimental UBSAN support [1].

Besides adjusting the iovec size, a new runtime and check is added to
avoid wrong __libc_message_impl usage.

Checked on x86_64-linux-gnu.

[1] https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/azanella/ubsan-undef

Co-authored-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
include/stdio.h
posix/Makefile
posix/tst-libc-message.c [new file with mode: 0644]
sysdeps/posix/libc_fatal.c