der: fix asan/valgrind errors in time parsing

pull/2319/head
Victor Julien 9 years ago
parent 7e4df3a1d1
commit 595c20ddf4

@ -85,7 +85,7 @@ static time_t GentimeToTime(char *gentime)
if (strlen(gentime) != 15)
goto error;
tm.tm_gmtoff = 0;
memset(&tm, 0, sizeof(tm));
strptime(gentime, "%Y%m%d%H%M%SZ", &tm);
time = SCMkTimeUtc(&tm);
@ -102,7 +102,7 @@ static time_t UtctimeToTime(char *utctime)
{
time_t time;
unsigned int year;
char yy[2];
char yy[3];
char buf[20];
/* UTCTime values MUST be expressed in Greenwich Mean Time (Zulu)

@ -180,6 +180,7 @@ void CreateIsoTimeString (const struct timeval *ts, char *str, size_t size)
{
time_t time = ts->tv_sec;
struct tm local_tm;
memset(&local_tm, 0, sizeof(local_tm));
struct tm *t = (struct tm*)SCLocalTime(time, &local_tm);
char time_fmt[64] = { 0 };
@ -195,6 +196,7 @@ void CreateUtcIsoTimeString (const struct timeval *ts, char *str, size_t size)
{
time_t time = ts->tv_sec;
struct tm local_tm;
memset(&local_tm, 0, sizeof(local_tm));
struct tm *t = (struct tm*)SCUtcTime(time, &local_tm);
char time_fmt[64] = { 0 };

Loading…
Cancel
Save