26 Jan
2018
26 Jan
'18
9:29 a.m.
From: Luo Xionghu xionghu.luo@intel.com
Avoid NULL dereference if function localtime return invalid value.
Signed-off-by: Luo Xionghu xionghu.luo@intel.com --- rimage/css.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/rimage/css.c b/rimage/css.c index f662f0b..064a75a 100644 --- a/rimage/css.c +++ b/rimage/css.c @@ -33,6 +33,9 @@ void ri_css_hdr_create(struct image *image) /* get local time and date */ gettimeofday(&tv, NULL); date = localtime(&tv.tv_sec); + if (date == NULL) + return; + date->tm_year += 1900; fprintf(stdout, " css: set build date to %d:%2.2d:%2.2d\n", date->tm_year, date->tm_mon, date->tm_mday);
--
2.11.0