]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
stub: drop PE sections parsing cap
authorLuca Boccassi <luca.boccassi@gmail.com>
Fri, 10 Jan 2025 21:02:55 +0000 (21:02 +0000)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 10 Jan 2025 22:51:46 +0000 (22:51 +0000)
This was added originally as it was thought that Windows applied
the same cap. Nowadays the specs do not mention it, and it is
believed Windows no longer applies it either, so drop it in order
to allow an arbitrary number of DTBs to be included

Fixes https://github.com/systemd/systemd/issues/35943

src/boot/pe.c

index 173b2c0898ff65cdda80f32e717cf4c65bce1b0c..97ea8d7220a643ada29e474cda910760ed8828c2 100644 (file)
@@ -7,7 +7,6 @@
 
 #define DOS_FILE_MAGIC "MZ"
 #define PE_FILE_MAGIC  "PE\0\0"
-#define MAX_SECTIONS 96
 
 #if defined(__i386__)
 #  define TARGET_MACHINE_TYPE 0x014CU
@@ -132,7 +131,6 @@ static bool verify_pe(
                 (pe->FileHeader.Machine == TARGET_MACHINE_TYPE ||
                  (allow_compatibility && pe->FileHeader.Machine == TARGET_MACHINE_TYPE_COMPATIBILITY)) &&
                 pe->FileHeader.NumberOfSections > 0 &&
-                pe->FileHeader.NumberOfSections <= MAX_SECTIONS &&
                 IN_SET(pe->OptionalHeader.Magic, OPTHDR32_MAGIC, OPTHDR64_MAGIC) &&
                 pe->FileHeader.SizeOfOptionalHeader < SIZE_MAX - (dos->ExeHeader + offsetof(PeFileHeader, OptionalHeader));
 }