diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/journal/journal-def.h | 1 | ||||
-rw-r--r-- | src/journal/journal-file.c | 3 | ||||
-rw-r--r-- | src/journal/journal-verify.c | 7 |
3 files changed, 11 insertions, 0 deletions
diff --git a/src/journal/journal-def.h b/src/journal/journal-def.h index e61e81ca84..660a92c147 100644 --- a/src/journal/journal-def.h +++ b/src/journal/journal-def.h @@ -185,6 +185,7 @@ _packed_ struct Header { le64_t n_fields; /* Added in 189 */ le64_t n_tags; + le64_t n_entry_arrays; }; #define FSPRG_HEADER_SIGNATURE ((char[]) { 'K', 'S', 'H', 'H', 'R', 'H', 'L', 'P' }) diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c index e0b20ccefd..81952a08ee 100644 --- a/src/journal/journal-file.c +++ b/src/journal/journal-file.c @@ -839,6 +839,9 @@ static int link_entry_into_array(JournalFile *f, o->entry_array.next_entry_array_offset = htole64(q); } + if (JOURNAL_HEADER_CONTAINS(f->header, n_entry_arrays)) + f->header->n_entry_arrays = htole64(le64toh(f->header->n_entry_arrays) + 1); + *idx = htole64(hidx + 1); return 0; diff --git a/src/journal/journal-verify.c b/src/journal/journal-verify.c index 55ca52a641..b4e34d18a8 100644 --- a/src/journal/journal-verify.c +++ b/src/journal/journal-verify.c @@ -837,6 +837,13 @@ int journal_file_verify(JournalFile *f, const char *key) { goto fail; } + if (JOURNAL_HEADER_CONTAINS(f->header, n_entry_arrays) && + n_entry_arrays != le64toh(f->header->n_entry_arrays)) { + log_error("Entry array number mismatch"); + r = -EBADMSG; + goto fail; + } + if (n_data_hash_tables != 1) { log_error("Missing data hash table"); r = -EBADMSG; |