[gnutls-dev] UTCTime to time_t drops seconds

Joe Orton joe at manyfish.co.uk
Thu Oct 7 23:21:20 CEST 2004


I don't have a simple repro case for this, but it looks like a fairly
simple bug: the UTCTime -> time_t conversion is dropping the seconds
digits, as returned by the gnutls_x509_crt_get_*_time functions.

I'm working from RPMs so I don't have a patch to test, but it looks
simply like _gnutls_x509_time2gtime should check whether the time string
includes the seconds digits (which are optional in UTCTime), instead of
setting tm_sec to 0 always, something like:

   if (strlen(ttime) >= 2) {
       memcpy(xx, ttime, 2);
       etime.tm_sec = atoi(xx);
       ttime += 2;
   } else {
       etime.tm_sec = 0;
   }

joe



More information about the Gnutls-dev mailing list