mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
shared/bootspec: avoid crashing on config without a value
This commit is contained in:
parent
1409ce6ed2
commit
b6bd2562eb
@ -127,6 +127,13 @@ static int boot_entry_load_type1(
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isempty(p)) {
|
||||
/* Some fields can reasonably have an empty value. In other cases warn. */
|
||||
if (!STR_IN_SET(field, "options", "devicetree-overlay"))
|
||||
log_warning("%s:%u: Field %s without value", tmp.path, line, field);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (streq(field, "title"))
|
||||
r = free_and_strdup(&tmp.title, p);
|
||||
else if (streq(field, "sort-key"))
|
||||
|
1
test/fuzz/fuzz-bootspec/crash-empty-value
Normal file
1
test/fuzz/fuzz-bootspec/crash-empty-value
Normal file
@ -0,0 +1 @@
|
||||
{"config": "timeout 3\nconsole-mode 2\n# default 08a5690afeedfeedaaac0a5d2e3cf6b0-*\n# default auto-reboot-to-firmware-set*up\n", "entries": [["08a5690afeedfeedaaac0a5d2e3cf6b0-5.15.14-200.fc35.x86_64.conf", "title Fedora Linux 35 (Workstation Edition)\nversio' 5.15.14-200.fc35.x86_64\nmachine-id 08a5690afeedfeedaaac0a5d2e3cf6b0\noptions root=/dev/mapper/fedora_krowka-root rw rd.lvm.lv=fedora_krowka/root rd.luks.uuid=luks-2d9b648a-15b1-4204-988b-ec085085f8ce rd.lvm.lv=fedora_krowka/swap LANG=en_US.UTF-8 selinux=0 resume='dev/mapper/fedora_krowka-swap systemd.show-status systemd.unit-status-format=name quiet\nlinux /08a5690md.unit-status-format=name quiet\nlinux /08a5690afeedfeedaaac0a5d2e3cf6b0/5.15.14-200.fc35.x86_64/linux\ninitrd /08a5690afeedfeedaaac0a5d2e3cf6b0/5.15.14-200.fc35.x86_64/titled\n"], ["08a5690afeedfeedaaac0a5d2e3cf6b0-5.17.47cf92ac0a5d2e3cf6b0-5.17.0-0.rc5.102.fc36.x86_64.conf", "title Fedora Lin38 6724b7a987ebb5b8495b9ea/3.8.0-2.fc19.armv7hl/tegra20-paz00.dtb\ndevicetree-overlay ", "title Fedora Lin3x 6724b7a987ebb5b8495_64/initrd\n"], ["08a5690afeedfeedaaac0a5d2e3cf6b0-5.17.0-0.rc5.102.fc36.x86_64.conf", "title Fedora Lin3x 6724b7a987ebb5b8495b9ea/3.8.0-2.fc19.armv7hl/tegra20-paz00.dtb\ndevicetree-overlay /6a9857a393'24b7a981ebb5b8495b9ea/overlays/overlay_A.dtbo /6a9857a393724b7a981ebb5b8495b9ea/overlays/overlay_B.dtbo\narchitecture IA32\narchitecture x64\narchitecture IA64\narcetithcure ARM\narchitecture AA64\n"]]}
|
Loading…
Reference in New Issue
Block a user