diff options
author | Simon McVittie <smcv@debian.org> | 2020-03-15 13:00:08 +0000 |
---|---|---|
committer | Niels De Graef <nielsdegraef@gmail.com> | 2020-03-15 17:45:54 +0000 |
commit | b1c8213b64fdfcad8c4ae0ff33a31105c0a0a312 (patch) | |
tree | de36cd88e1ac162103d0115a81f4cf775210d322 /gck | |
parent | 91eeb2ea264119a3eb3b72487574ebf91322ebd1 (diff) | |
download | gcr-b1c8213b64fdfcad8c4ae0ff33a31105c0a0a312.tar.gz |
gck-slot: Initialize struct tm to all-zeroes
If the format string for strptime() doesn't include a time zone,
then the tm_isdst member will be left uninitialized (see NOTES in
Linux strptime(3)). This means we will be off by an hour from the
intended time if whatever arbitrary junk is on the stack happens to
include a positive value for tm.tm_isdst.
Resolves: https://gitlab.gnome.org/GNOME/gcr/issues/42
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=953981
Signed-off-by: Simon McVittie <smcv@debian.org>
Diffstat (limited to 'gck')
-rw-r--r-- | gck/gck-slot.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gck/gck-slot.c b/gck/gck-slot.c index f3b2f97..f00857f 100644 --- a/gck/gck-slot.c +++ b/gck/gck-slot.c @@ -607,7 +607,9 @@ _gck_token_info_from_pkcs11 (CK_TOKEN_INFO_PTR info) { GckTokenInfo *token_info; gchar *string; - struct tm tm; + /* Must be zero-filled, because strptime will leave tm_isdst + * unchanged */ + struct tm tm = { 0 }; token_info = g_new0 (GckTokenInfo, 1); token_info->label = gck_string_from_chars (info->label, sizeof (info->label)); |