Blame SOURCES/0063-sudo-memset-tm-when-converting-time-attributes.patch

2fc102
From 89eca8339610956f8d95d701dc02d3f8256e2770 Mon Sep 17 00:00:00 2001
2fc102
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
2fc102
Date: Wed, 29 Jan 2014 12:56:08 +0100
2fc102
Subject: [PATCH 63/71] sudo: memset tm when converting time attributes
2fc102
2fc102
strptime() which is used to parse LDAP time value does not initialize
2fc102
all fields of tm structure (especially tm_isdst). This results in
2fc102
random behavior - when the tm is converted into timestamp via mktime(),
2fc102
the result depends on current value of tm_isdst.
2fc102
2fc102
Resolves:
2fc102
https://fedorahosted.org/sssd/ticket/2213
2fc102
2fc102
b
2fc102
---
2fc102
 src/db/sysdb_sudo.c | 2 ++
2fc102
 1 file changed, 2 insertions(+)
2fc102
2fc102
diff --git a/src/db/sysdb_sudo.c b/src/db/sysdb_sudo.c
2fc102
index 4e98b5b35f3968a1db68c32812eac71670578b60..ceaecbd2666cfb84422bd72b3109da9c4aa0f0f3 100644
2fc102
--- a/src/db/sysdb_sudo.c
2fc102
+++ b/src/db/sysdb_sudo.c
2fc102
@@ -56,6 +56,8 @@ static errno_t sysdb_sudo_convert_time(const char *str, time_t *unix_time)
2fc102
                              NULL};
2fc102
 
2fc102
     for (format = formats; *format != NULL; format++) {
2fc102
+        /* strptime() may leave some fields uninitialized */
2fc102
+        memset(&tm, 0, sizeof(struct tm));
2fc102
         tret = strptime(str, *format, &tm;;
2fc102
         if (tret != NULL && *tret == '\0') {
2fc102
             *unix_time = mktime(&tm;;
2fc102
-- 
2fc102
1.8.4.2
2fc102