asn1: Fix warnings
This commit is contained in:
@@ -597,6 +597,7 @@ _heim_time2generalizedtime (time_t t, heim_octet_string *s, int gtimep)
|
||||
{
|
||||
struct tm tm;
|
||||
const size_t len = gtimep ? 15 : 13;
|
||||
int bytes;
|
||||
|
||||
s->data = NULL;
|
||||
s->length = 0;
|
||||
@@ -607,13 +608,16 @@ _heim_time2generalizedtime (time_t t, heim_octet_string *s, int gtimep)
|
||||
return ENOMEM;
|
||||
s->length = len;
|
||||
if (gtimep)
|
||||
snprintf (s->data, len + 1, "%04d%02d%02d%02d%02d%02dZ",
|
||||
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec);
|
||||
bytes = snprintf(s->data, len + 1, "%04d%02d%02d%02d%02d%02dZ",
|
||||
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec);
|
||||
else
|
||||
snprintf (s->data, len + 1, "%02d%02d%02d%02d%02d%02dZ",
|
||||
tm.tm_year % 100, tm.tm_mon + 1, tm.tm_mday,
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec);
|
||||
bytes = snprintf(s->data, len + 1, "%02d%02d%02d%02d%02d%02dZ",
|
||||
tm.tm_year % 100, tm.tm_mon + 1, tm.tm_mday,
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec);
|
||||
|
||||
if (bytes > len)
|
||||
abort();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user