From: Yu Watanabe Date: Thu, 21 Sep 2023 20:08:12 +0000 (+0900) Subject: sd-journal: refuse entry objects with an empty boot ID X-Git-Tag: v255-rc1~462 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c650d4cdef5c1b87237193995f08d7e2d1be0c44;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c index 0447bcde577..ef860d228b9 100644 --- a/src/libsystemd/sd-journal/journal-file.c +++ b/src/libsystemd/sd-journal/journal-file.c @@ -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; }