kernel-image: handle errors when reading the .osrel section

uki_read_pretty_name() only handles a missing .osrel section. Any other
error, for example an .osrel section larger than PE_SECTION_READ_MAX,
passes a NULL buffer to parse_env_data(), and "bootctl kernel-inspect"
aborts:

    Assertion 'data' failed at src/basic/env-file.c:429

Return the error instead.

(cherry picked from commit 37717744394b433eb452674f060a4288a8f469bf)
This commit is contained in:
Daan De Meyer
2026-10-16 17:24:51 +01:00
committed by Luca Boccassi
parent 762840e4e0
commit cec20dc153
+2
View File
@@ -49,6 +49,8 @@ static int uki_read_pretty_name(
*ret = NULL;
return 0;
}
if (r < 0)
return log_debug_errno(r, "Failed to read .osrel section: %m");
r = parse_env_data(
osrel, osrel_size, ".osrel",