summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2014-01-29 12:56:08 +0100
committerJakub Hrozek <jhrozek@redhat.com>2014-01-29 14:58:09 +0100
commit89eca8339610956f8d95d701dc02d3f8256e2770 (patch)
treea1d516754b4902ad6360f97e03ee53d7a2602c2f /src
parent2ea997d55fb7b18bbf153d5fa625b688285dfdb9 (diff)
downloadsssd-89eca8339610956f8d95d701dc02d3f8256e2770.tar.gz
sssd-89eca8339610956f8d95d701dc02d3f8256e2770.tar.xz
sssd-89eca8339610956f8d95d701dc02d3f8256e2770.zip
sudo: memset tm when converting time attributes
strptime() which is used to parse LDAP time value does not initialize all fields of tm structure (especially tm_isdst). This results in random behavior - when the tm is converted into timestamp via mktime(), the result depends on current value of tm_isdst. Resolves: https://fedorahosted.org/sssd/ticket/2213 b
Diffstat (limited to 'src')
-rw-r--r--src/db/sysdb_sudo.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/db/sysdb_sudo.c b/src/db/sysdb_sudo.c
index 4e98b5b35..ceaecbd26 100644
--- a/src/db/sysdb_sudo.c
+++ b/src/db/sysdb_sudo.c
@@ -56,6 +56,8 @@ static errno_t sysdb_sudo_convert_time(const char *str, time_t *unix_time)
NULL};
for (format = formats; *format != NULL; format++) {
+ /* strptime() may leave some fields uninitialized */
+ memset(&tm, 0, sizeof(struct tm));
tret = strptime(str, *format, &tm);
if (tret != NULL && *tret == '\0') {
*unix_time = mktime(&tm);