mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-25 06:03:40 +03:00
journal: refuse an entry with invalid timestamp fields
The journal verification functions would reject such an entry. It would probably still display fine (because we prefer _SOURCE_REALTIME_TIMESTAMP= if present), but it seems wrong to create an entry that would not pass verification.
This commit is contained in:
parent
4d9685be5f
commit
c627395366
@ -1958,7 +1958,16 @@ int journal_file_append_entry(JournalFile *f, const dual_timestamp *ts, const st
|
||||
assert(f->header);
|
||||
assert(iovec || n_iovec == 0);
|
||||
|
||||
if (!ts) {
|
||||
if (ts) {
|
||||
if (!VALID_REALTIME(ts->realtime)) {
|
||||
log_debug("Invalid realtime timestamp %"PRIu64", refusing entry.", ts->realtime);
|
||||
return -EBADMSG;
|
||||
}
|
||||
if (!VALID_MONOTONIC(ts->monotonic)) {
|
||||
log_debug("Invalid monotomic timestamp %"PRIu64", refusing entry.", ts->monotonic);
|
||||
return -EBADMSG;
|
||||
}
|
||||
} else {
|
||||
dual_timestamp_get(&_ts);
|
||||
ts = &_ts;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user