]> git.ipfire.org Git - thirdparty/systemd.git/commit
boot: make device_path_next_node() robust against malformed zero-length nodes
authorLuca Boccassi <luca.boccassi@gmail.com>
Fri, 26 Jun 2026 16:21:52 +0000 (17:21 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 3 Jul 2026 14:19:38 +0000 (15:19 +0100)
commit3bcd707d5650fdf91de19cf6e1ca5bbac7686967
treed7a856807f01c6c638aa5b104a1681a30d8a6d1f
parentd06d8a232bf8ff4b27e4b5326dcec9717d89f3bc
boot: make device_path_next_node() robust against malformed zero-length nodes

device_path_next_node() advances by the current node's Length field,
which per the EFI device path protocol includes the 4-byte node header;
a well-formed node is therefore at least sizeof(EFI_DEVICE_PATH) bytes
long. A malformed node with Length < sizeof(EFI_DEVICE_PATH), in
particular Length == 0, makes the helper return its input pointer
unchanged.

Advance by at least sizeof(EFI_DEVICE_PATH).

Follow-up for 5080a60a719da213fa90964b76cc90bd0d1cb8de
src/boot/device-path-util.c
src/boot/device-path-util.h