ostree/parse-datetime: Ensure tm structs are initialised
authorPhilip Withnall <withnall@endlessm.com>
Mon, 7 Aug 2017 13:13:30 +0000 (14:13 +0100)
committerAtomic Bot <atomic-devel@projectatomic.io>
Tue, 8 Aug 2017 14:11:07 +0000 (14:11 +0000)
Otherwise tm.tm_wday remains uninitialised and gets propagated
elsewhere.

Spotted by Coverity as issue #209265.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #1059
Approved by: cgwalters

src/ostree/parse-datetime.y

index f5688d30b511bb86c48609854f4bef1947fb1950..5091735457442e66348db74f341345a6b936e0fa 100644 (file)
@@ -1280,8 +1280,8 @@ parse_datetime (struct timespec *result, char const *p,
   time_t Start;
   long int Start_ns;
   struct tm const *tmp;
-  struct tm tm;
-  struct tm tm0;
+  struct tm tm = { 0, };
+  struct tm tm0 = { 0, };
   parser_control pc;
   struct timespec gettime_buffer;
   unsigned char c;