sd-journal: refuse entry objects with an empty boot ID

Otherwise, e.g. sd_journal_get_monotonic_usec() return an empty boot ID
when called for such a broken entry object.

Such a broken object may be stored when the system was not cleanly shutdown.

Fixes #29167.
This commit is contained in:
Yu Watanabe
2023-09-22 08:05:53 +02:00
committed by Zbigniew Jędrzejewski-Szmek
parent 1365355d14
commit c650d4cdef
+5
View File
@@ -991,6 +991,11 @@ static int check_object(JournalFile *f, Object *o, uint64_t offset) {
le64toh(o->entry.monotonic),
offset);
if (sd_id128_is_null(o->entry.boot_id))
return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG),
"Invalid object entry with an empty boot ID: %" PRIu64,
offset);
break;
}