diff options
-rw-r--r-- | krl.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -14,7 +14,7 @@ | |||
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | /* $OpenBSD: krl.c,v 1.18 2014/11/17 00:21:40 djm Exp $ */ | 17 | /* $OpenBSD: krl.c,v 1.19 2014/11/21 01:00:38 djm Exp $ */ |
18 | 18 | ||
19 | #include "includes.h" | 19 | #include "includes.h" |
20 | 20 | ||
@@ -747,8 +747,12 @@ format_timestamp(u_int64_t timestamp, char *ts, size_t nts) | |||
747 | 747 | ||
748 | t = timestamp; | 748 | t = timestamp; |
749 | tm = localtime(&t); | 749 | tm = localtime(&t); |
750 | *ts = '\0'; | 750 | if (tm == NULL) |
751 | strftime(ts, nts, "%Y%m%dT%H%M%S", tm); | 751 | strlcpy(ts, "<INVALID>", sizeof(nts)); |
752 | else { | ||
753 | *ts = '\0'; | ||
754 | strftime(ts, nts, "%Y%m%dT%H%M%S", tm); | ||
755 | } | ||
752 | } | 756 | } |
753 | 757 | ||
754 | static int | 758 | static int |