shared/bootspec: avoid crashing on config without a value

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2022-05-08 17:58:00 +02:00
parent 1409ce6ed2
commit b6bd2562eb
2 changed files with 8 additions and 0 deletions
+7
View File
@@ -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"))