about summary refs log tree commit diff
path: root/include/err.h
diff options
context:
space:
mode:
authorMarkus Wichmann <nullplan@gmx.net>2022-11-03 20:42:16 +0100
committerRich Felker <dalias@aerifal.cx>2022-12-14 10:03:37 -0500
commit7d358599d4c8f793cfb42ee49ff5e1d107de6ee4 (patch)
tree6039a28651b26d731d556d6a5da05c2a7b0a962b /include/err.h
parentc5f4b2dfea320356f69445dc1adf8f73596a3c36 (diff)
downloadmusl-7d358599d4c8f793cfb42ee49ff5e1d107de6ee4.tar.gz
musl-7d358599d4c8f793cfb42ee49ff5e1d107de6ee4.tar.xz
musl-7d358599d4c8f793cfb42ee49ff5e1d107de6ee4.zip
prevent invalid reads of nl_arg in printf_core
printf_core() runs twice, and during its first run, nl_arg is
uninitialized and must not be read. It gets initialized at the end of
the first run. Conversely, nl_type does not need to be set during the
second run, as its useful life has ended at that point, since the only
time it is read is during that exact same initialization. Therefore we
can simply alternate the assignments.

p and w do still need to get values assigned to them, since at least one
line in the same if-statement depends on that, but they can be dummy
values. arg does not need to be assigned, since in the first run, we
encounter a continue statement before using the argument.
Diffstat (limited to 'include/err.h')
0 files changed, 0 insertions, 0 deletions