]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
wintime: add a precautionary memset to zero.
authorSimon Tatham <anakin@pobox.com>
Tue, 14 Feb 2017 20:29:38 +0000 (20:29 +0000)
committerSimon Tatham <anakin@pobox.com>
Tue, 14 Feb 2017 23:25:25 +0000 (23:25 +0000)
Coverity observes that sometimes 'struct tm' can have other fields
(e.g. glibc's tm_gmtoff), so it's as well to make sure we initialise
the whole thing to zero.

windows/wintime.c

index eebed9e5a4e4e5922a42d51f85be768d7df98d09..5fa3b0ded19e4f6d571b74c2d28169e653ad3061 100644 (file)
@@ -10,6 +10,8 @@ struct tm ltime(void)
     SYSTEMTIME st;
     struct tm tm;
 
+    memset(&tm, 0, sizeof(tm));        /* in case there are any other fields */
+
     GetLocalTime(&st);
     tm.tm_sec=st.wSecond;
     tm.tm_min=st.wMinute;