]> git.ipfire.org Git - thirdparty/systemd.git/commit
stub: Fix NULL pointer deref when there are no initrds
authorHans de Goede <johannes.goede@oss.qualcomm.com>
Mon, 12 Jan 2026 13:56:36 +0000 (14:56 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 12 Jan 2026 23:33:25 +0000 (08:33 +0900)
commit3f4279829eb6c15bdbc0d4252bbefe0c4fd9ec23
tree9bc03832720504f77e9f5d934a22825555bbb4d3
parent9e36307a8a2f852d1533cc5b7ec896cf9acc8761
stub: Fix NULL pointer deref when there are no initrds

When n_all_initrds == 0, then all_initrds is unmodified from its initial
value of:

_cleanup_free_ struct iovec *all_initrds = NULL;

and in the else block of the "if (n_all_initrds > 1)" the NULL is
dereferenced:

final_initrd = all_initrds[0];

Leading to the stub crashing due to a NULL pointer deref.

Fix this by initializing final_initrd to all 0s and only
running the else block if (n_all_initrds == 1).
src/boot/stub.c