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
This commit is contained in:
Christian Helmuth 2017-05-05 08:44:06 +02:00
parent e9b42a127b
commit c79155fd7b
1 changed files with 2 additions and 0 deletions

View File

@ -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);