]> git.ipfire.org Git - thirdparty/systemd.git/commit
boot: require a minimum PE optional header size in verify_pe() 42767/head
authorLuca Boccassi <luca.boccassi@gmail.com>
Fri, 26 Jun 2026 22:12:54 +0000 (23:12 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 3 Jul 2026 14:19:39 +0000 (15:19 +0100)
commit918e8f9dd91e5f51cd06b599ef3cbe534aaff28d
tree721f7863f3a1eb845c32b7d7f5066790690103ec
parentbaad1744bd0bd4302ee438c7f1ba60217e758199
boot: require a minimum PE optional header size in verify_pe()

verify_pe() only checked SizeOfOptionalHeader against a SIZE_MAX wrap (a
clause that, given SizeOfOptionalHeader is a uint16_t, can never reject
anything) and never read NumberOfRvaAndSizes. But pe_kernel_info(),
pe_kernel_check_nx_compat() and pe_kernel_check_no_relocation() then read
SizeOfImage, AddressOfEntryPoint, DllCharacteristics and the base
relocation data directory entry from the optional header.

Require SizeOfOptionalHeader to be large enough to contain everything down
to the base relocation data directory entry, and require the image to
declare that many data directory entries.

Follow-up for bacc2ed0d5bb10de5d37a1df73c061247f005b59
src/boot/pe.c