mirror of
https://github.com/systemd/systemd.git
synced 2025-02-03 17:47:28 +03:00
Merge pull request #27419 from yuwata/sd-journal-entry-item
sd-journal: skip invalid entry item
This commit is contained in:
commit
c00f0634ad
@ -4168,8 +4168,8 @@ int journal_file_copy_entry(
|
||||
|
||||
_cleanup_free_ EntryItem *items_alloc = NULL;
|
||||
EntryItem *items;
|
||||
uint64_t q, n, xor_hash = 0;
|
||||
const sd_id128_t *boot_id;
|
||||
uint64_t n, m = 0, xor_hash = 0;
|
||||
sd_id128_t boot_id;
|
||||
dual_timestamp ts;
|
||||
int r;
|
||||
|
||||
@ -4185,9 +4185,11 @@ int journal_file_copy_entry(
|
||||
.monotonic = le64toh(o->entry.monotonic),
|
||||
.realtime = le64toh(o->entry.realtime),
|
||||
};
|
||||
boot_id = &o->entry.boot_id;
|
||||
boot_id = o->entry.boot_id;
|
||||
|
||||
n = journal_file_entry_n_items(from, o);
|
||||
if (n == 0)
|
||||
return 0;
|
||||
|
||||
if (n < ALLOCA_MAX / sizeof(EntryItem) / 2)
|
||||
items = newa(EntryItem, n);
|
||||
@ -4200,7 +4202,7 @@ int journal_file_copy_entry(
|
||||
}
|
||||
|
||||
for (uint64_t i = 0; i < n; i++) {
|
||||
uint64_t h;
|
||||
uint64_t h, q;
|
||||
void *data;
|
||||
size_t l;
|
||||
Object *u;
|
||||
@ -4227,7 +4229,7 @@ int journal_file_copy_entry(
|
||||
else
|
||||
xor_hash ^= le64toh(u->data.hash);
|
||||
|
||||
items[i] = (EntryItem) {
|
||||
items[m++] = (EntryItem) {
|
||||
.object_offset = h,
|
||||
.hash = le64toh(u->data.hash),
|
||||
};
|
||||
@ -4240,14 +4242,17 @@ int journal_file_copy_entry(
|
||||
return r;
|
||||
}
|
||||
|
||||
if (m == 0)
|
||||
return 0;
|
||||
|
||||
r = journal_file_append_entry_internal(
|
||||
to,
|
||||
&ts,
|
||||
boot_id,
|
||||
&boot_id,
|
||||
&from->header->machine_id,
|
||||
xor_hash,
|
||||
items,
|
||||
n,
|
||||
m,
|
||||
seqnum,
|
||||
seqnum_id,
|
||||
/* ret_object= */ NULL,
|
||||
|
Loading…
x
Reference in New Issue
Block a user