remove sprintf

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12086 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2003-04-17 07:12:24 +00:00
parent 03b4bd44fb
commit bdef0a4d2b

View File

@@ -375,15 +375,18 @@ int
time2generalizedtime (time_t t, octet_string *s)
{
struct tm *tm;
size_t len;
s->data = malloc(16);
len = 15;
s->data = malloc(len + 1);
if (s->data == NULL)
return ENOMEM;
s->length = 15;
s->length = len;
tm = gmtime (&t);
sprintf (s->data, "%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);
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);
return 0;
}