]> git.ipfire.org Git - thirdparty/systemd.git/commit
efi-api: validate boot option device path lengths 42926/head
authordongshengyuan <545258830@qq.com>
Thu, 9 Jul 2026 00:39:03 +0000 (08:39 +0800)
committerdongshengyuan <545258830@qq.com>
Thu, 9 Jul 2026 00:39:03 +0000 (08:39 +0800)
commitd13b002aec366aeab72019dce86e956e8c7ba65c
tree58443b0b5b1f532e217fc39d8849639d5f860aa9
parentccae5c7a4f269bcd7fac39baf93c1cee2c1536a8
efi-api: validate boot option device path lengths

efi_get_boot_option() validates the overall Boot#### variable size and
the advertised device-path byte count, but then walks each device-path
node without first checking that the node header and subtype payload fit
in the remaining buffer.

A malformed Boot#### variable could make the parser read past the end of
the current node, or past the available device-path data.

Limit parsing to the bytes that are actually present, and stop walking
the device path when a malformed node is encountered. This keeps the
previous best-effort behaviour for fields parsed before the anomaly while
avoiding out-of-bounds reads.

Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
src/shared/efi-api.c