From c79155fd7bdff6cb4b4ed5c4e4180bf9d0b31c89 Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Fri, 5 May 2017 08:44:06 +0200 Subject: [PATCH] libc_ffat: zero-init 'struct tm' on stack This prevents the following runtime error. Error: mktime() returned -1, the file modification time reported by stat() will be incorrect --- repos/libports/src/lib/libc_ffat/plugin.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/repos/libports/src/lib/libc_ffat/plugin.cc b/repos/libports/src/lib/libc_ffat/plugin.cc index 9ddec49983..4375fc965d 100644 --- a/repos/libports/src/lib/libc_ffat/plugin.cc +++ b/repos/libports/src/lib/libc_ffat/plugin.cc @@ -718,6 +718,8 @@ class Plugin : public Libc::Plugin /* TODO: handle more attributes */ struct tm tm; + ::memset(&tm, 0, sizeof(tm)); + tm.tm_year = ((file_info.fdate & 0b1111111000000000) >> 9) + 80; tm.tm_mon = (file_info.fdate & 0b0000000111100000) >> 5; tm.tm_mday = (file_info.fdate & 0b0000000000011111);