]> git.ipfire.org Git - thirdparty/systemd.git/commit
sd-journal: do not read unnecessary object
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 2 Jan 2024 19:30:29 +0000 (04:30 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 9 Feb 2024 15:29:16 +0000 (00:29 +0900)
commit6c4ea35962fe8d9715101f99f4ac44b8c5eaf51b
tree65266f5e246dbed4111f78744cd81e11a809e62e
parent1b4e322cdbf773e335e07554ad3e4a235f6e88cb
sd-journal: do not read unnecessary object

In journal_file_next_entry(), if the passed offset matches an entry object,
then generic_array_bisect() returns the object, but the object we
requested is the next (or previous) object. Hence, we should not validate
the object returned by generic_array_bisect(), otherwise it may fail
when the journal is corrupted.

Note the validity of the entry object that should be returned by
journal_file_next_entry() will be checked in the following generic_array_get().
So, when journal_file_next_entry() succeeds, the returned object is
always validated.
src/libsystemd/sd-journal/journal-file.c