spoolss: Fix CID 1414784 Uninitialized scalar variable
authorVolker Lendecke <vl@samba.org>
Tue, 11 Jul 2017 11:50:09 +0000 (13:50 +0200)
committerVolker Lendecke <vl@samba.org>
Wed, 12 Jul 2017 15:45:24 +0000 (17:45 +0200)
"struct tm" can contain more members than we explicitly initialize.

Initialize them all.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/rpc_client/init_spoolss.c

index a806fc6ce09a44be7a08de62cdfefee044c86105..e5f70c0b045a4ee15f056f5cd47a4a671ef5e3fd 100644 (file)
@@ -48,15 +48,15 @@ bool init_systemtime(struct spoolss_Time *r,
 
 time_t spoolss_Time_to_time_t(const struct spoolss_Time *r)
 {
-       struct tm unixtime;
-
-       unixtime.tm_year        = r->year - 1900;
-       unixtime.tm_mon         = r->month - 1;
-       unixtime.tm_wday        = r->day_of_week;
-       unixtime.tm_mday        = r->day;
-       unixtime.tm_hour        = r->hour;
-       unixtime.tm_min         = r->minute;
-       unixtime.tm_sec         = r->second;
+       struct tm unixtime = {
+               .tm_year        = r->year - 1900,
+               .tm_mon         = r->month - 1,
+               .tm_wday        = r->day_of_week,
+               .tm_mday        = r->day,
+               .tm_hour        = r->hour,
+               .tm_min         = r->minute,
+               .tm_sec         = r->second,
+       };
 
        return mktime(&unixtime);
 }