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

Pavel Březina pbrezina at redhat.com
Wed Jan 29 13:45:49 UTC 2014


On 01/29/2014 01:29 PM, Jakub Hrozek wrote:
> 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.

You are probably right. New patch is attached.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-sudo-memset-tm-when-converting-time-attributes.patch
Type: text/x-patch
Size: 1256 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20140129/1ae48f5c/attachment.bin>


More information about the sssd-devel mailing list