[SSSD] [PATCH] sudo: set tm_isdst when converting time attributes

Jakub Hrozek jhrozek at redhat.com
Wed Jan 29 12:29:29 UTC 2014


On Wed, Jan 29, 2014 at 12:58:24PM +0100, Pavel Březina wrote:
> https://fedorahosted.org/sssd/ticket/2213

>      for (format = formats; *format != NULL; format++) {
>          tret = strptime(str, *format, &tm);
>          if (tret != NULL && *tret == '\0') {
> +            /* strptime() leaves isdst uninitialized. We set it to zero to
> +             * disable daylight saving time conversion. */
> +            tm.tm_isdst = 0;
> +

Isn't it safer to memset the tm structure to zero before calling
strptime? That way you'd be protected against any other fields being
uninitialized as well.



More information about the sssd-devel mailing list