1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

wintime: add a precautionary memset to zero.

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.
This commit is contained in:
Simon Tatham 2017-02-14 20:29:38 +00:00
parent b6b52269e1
commit 2a2434e0cc

View File

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