From 03d1319b12b073979b900ebea72e7e0bc8bb8b9c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 24 May 2018 08:37:47 +0200 Subject: [PATCH] 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. --- src/shared/logs-show.c | 4 +--- ...rash-5a8f03d4c3a46fcded39527084f437e8e4b54b76 | Bin 0 -> 7675 bytes 2 files changed, 1 insertion(+), 3 deletions(-) create mode 100644 test/fuzz-regressions/fuzz-journal-remote/crash-5a8f03d4c3a46fcded39527084f437e8e4b54b76 diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c index 401f3630527..739af3986d3 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 new file mode 100644 index 0000000000000000000000000000000000000000..e6a7316805d348191e5cc0238b282f543a361470 GIT binary patch literal 7675 zc-rk)UvJws5bv`-MZ0bf?Tbl?q{w+H>Nrj!)V2~yS(ibHCQ{|5{7 zjInIUHV0WUcMxI8^zrUU-=E(dSeC=XG)vNG5eX>*6Z*oZL^Cdk4hfS|s=8c*M^<&k z4e!sQpiu$s>&P-DWJp3PZKZ<#c|?^IB+%5a!~SK&Y)!cF$}$}d#(6v$mH5i?!DK(8 zj4(1OzArF+Gz^yp-%B>{H%Xs^GV;WM<2_qrX77nQzyE=+j z=ILOX?I&p-Ej}&I-v8+Br*V?T`B4;j*-=;E)C=hQhjC?XTbfHNOI~J%AT%s;OIQ7@R_bZe{V`dF3G(n0V!` z`hEj$Pg&$~}p{&jTxAyDPr0+p>1sQv~7>RCZIC0`eJuQp6BIiG~~plf{=s8(Jb9oYaup#Q%gj{koVt5Fx-X z1DDqgd4cEv`7B?)a_Wqaz$D`oi2T&iG_X=osaIHnds_3(fr^Dy0*}%!ek$(cNOiaL z;%lT=umS#?Tzy+Q8=9r}06Ha@jRI<0jy`}#IJhQ_c#hysm$jp9)b}re83ihb=~ay& z{?!G#6-3Zq>;!6xAs?_-*mq}6u?B?(%7X$KTBoybTntsJ=gP*?`49|B6~8vfV_;j1 z8cPuAm%QP4xemdF0dw&6(_`d=WwkfE!e~-#GYY`(alvH3LG|_^A4KHe9sZ->Vs*C^ z5No6WyH5)It)+ecK`bpE#nR2~mVR@)r6pOz(sCo3&W4SjF1xi$?DP)ie_ zbiksp24LOrpCNWw1QiOhc8N`IoglH1YZGPYpaz>hDf&C01Hnfi9EdGogmnTN)EdyL zY0e#I6JA3Hodf(4a)SLNY)6%Q5ciasz!G<`(;!j7o*F@>ihh{QKO(*z{EUom5hXVf zZ~WjvvLJkvEU;_f&69^1U2og%qI1D+`r8vp