]> git.ipfire.org Git - thirdparty/systemd.git/commit
journal: Don't try to write garbage if journal entry is corrupted
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 26 Apr 2023 11:21:55 +0000 (13:21 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 26 Apr 2023 11:46:25 +0000 (20:46 +0900)
commitf81409f844ae8077f7ee7664871f73fa7d440581
treede9ff34e4023ef7e062c52968f3bcdff90f91644
parent22148897cfa5cf06c19cead3d917e00721cb39cc
journal: Don't try to write garbage if journal entry is corrupted

If journal_file_data_payload() returns -EBADMSG or -EADDRNOTAVAIL,
we skip the entry and go to the next entry, but we never modify
the number of items that we pass to journal_file_append_entry_internal()
if that happens, which means we could try to append garbage to the
journal file.

Let's keep track of the number of fields we've appended to avoid this
problem.
src/libsystemd/sd-journal/journal-file.c