diff --git a/kadmin/util.c b/kadmin/util.c index 7f8313910..bd2da11f5 100644 --- a/kadmin/util.c +++ b/kadmin/util.c @@ -171,7 +171,8 @@ int str2time_t (const char *str, time_t *time) { const char *p; - struct tm tm; + struct tm tm, tm2; + char *t; memset (&tm, 0, sizeof (tm)); @@ -186,11 +187,15 @@ str2time_t (const char *str, time_t *time) return -1; /* Do it on the end of the day */ - tm.tm_hour = 23; - tm.tm_min = 59; - tm.tm_sec = 59; + tm2.tm_hour = 23; + tm2.tm_min = 59; + tm2.tm_sec = 59; - strptime (p, "%H:%M:%S", &tm); + if(strptime (p, "%H:%M:%S", &tm2) != NULL) { + tm.tm_hour = tm2.tm_hour; + tm.tm_min = tm2.tm_min; + tm.tm_sec = tm2.tm_sec; + } *time = tm2time (tm, 0); return 0;