Pointer, returned from function 'gmtime_r' at svlogd.c:355, may be NULL and is dereferenced at svlogd.c:358.
Found by RASU JSC with SVACE. Signed-off-by: Maks Mishin <[email protected]> --- runit/svlogd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runit/svlogd.c b/runit/svlogd.c index f7576f0fa..ff7224a34 100644 --- a/runit/svlogd.c +++ b/runit/svlogd.c @@ -353,6 +353,9 @@ static void fmt_time_human_30nul(char *s, char dt_delim) xgettimeofday(&tv); ptm = gmtime_r(&tv.tv_sec, &tm); + if (ptm == NULL) + return; + /* ^^^ using gmtime_r() instead of gmtime() to not use static data */ sprintf(s, "%04u-%02u-%02u%c%02u:%02u:%02u.%06u000", (unsigned)(1900 + ptm->tm_year), -- 2.34.1 _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
