diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-05-24 08:37:47 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-05-31 14:30:23 +0200 |
commit | 03d1319b12b073979b900ebea72e7e0bc8bb8b9c (patch) | |
tree | d3af8d710085e6f19b72324ea2ea48a56c23d8a1 | |
parent | c627395366bd3911ae4082e371fd73f64be8eed7 (diff) | |
download | systemd-03d1319b12b073979b900ebea72e7e0bc8bb8b9c.tar.gz |
shared/logs-show: be more careful before using a _SOURCE_REALTIME_TIMESTAMP entry
journalctl -o short would display those entries, but journalctl -o short-full
would refuse. If the entry is bad, just fall back to the receive-side realtime
timestamp like we would if it was completely missing.
-rw-r--r-- | src/shared/logs-show.c | 4 | ||||
-rw-r--r-- | test/fuzz-regressions/fuzz-journal-remote/crash-5a8f03d4c3a46fcded39527084f437e8e4b54b76 | bin | 0 -> 7675 bytes |
2 files changed, 1 insertions, 3 deletions
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c index 401f363052..739af3986d 100644 --- a/src/shared/logs-show.c +++ b/src/shared/logs-show.c @@ -293,10 +293,9 @@ static int output_timestamp_realtime(FILE *f, sd_journal *j, OutputMode mode, Ou assert(f); assert(j); - r = -ENXIO; if (realtime) r = safe_atou64(realtime, &x); - if (r < 0) + if (!realtime || r < 0 || !VALID_REALTIME(x)) r = sd_journal_get_realtime_usec(j, &x); if (r < 0) return log_error_errno(r, "Failed to get realtime timestamp: %m"); @@ -417,7 +416,6 @@ static int output_short( sd_journal_set_data_threshold(j, flags & (OUTPUT_SHOW_ALL|OUTPUT_FULL_WIDTH) ? 0 : PRINT_CHAR_THRESHOLD + 1); JOURNAL_FOREACH_DATA_RETVAL(j, data, length, r) { - r = parse_fieldv(data, length, fields, ELEMENTSOF(fields)); if (r < 0) return r; diff --git a/test/fuzz-regressions/fuzz-journal-remote/crash-5a8f03d4c3a46fcded39527084f437e8e4b54b76 b/test/fuzz-regressions/fuzz-journal-remote/crash-5a8f03d4c3a46fcded39527084f437e8e4b54b76 Binary files differnew file mode 100644 index 0000000000..e6a7316805 --- /dev/null +++ b/test/fuzz-regressions/fuzz-journal-remote/crash-5a8f03d4c3a46fcded39527084f437e8e4b54b76 |