systemd/backport-shared-bootspec-avoid-crashing-on-config-without-a-v.patch

32 lines
1.2 KiB
Diff
Raw Normal View History

2023-06-19 10:57:57 +08:00
From 412b89a6e8055f2c8c9db4b6b847f081e00461ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 6 May 2022 17:36:47 +0200
Subject: [PATCH] shared/bootspec: avoid crashing on config without a value
(cherry picked from commit b6bd2562ebb01b48cdb55a970d9daa1799b59876)
---
src/shared/bootspec.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c
index 0076092c2a..9e2b2899bd 100644
--- a/src/shared/bootspec.c
+++ b/src/shared/bootspec.c
@@ -124,6 +124,13 @@ static int boot_entry_load(
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, "version"))
--
2.33.0