From 134922ba7afdf9a7fe5b76c27277aa9eb20f0395 Mon Sep 17 00:00:00 2001 From: Gabriele Gristina Date: Sat, 3 Dec 2016 14:59:35 +0100 Subject: [PATCH] Fix wrong usage of ctime_r() --- src/status.c | 8 ++++---- src/terminal.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/status.c b/src/status.c index aebbbc9e8..4f95ada37 100644 --- a/src/status.c +++ b/src/status.c @@ -844,9 +844,9 @@ char *status_get_time_started_absolute (const hashcat_ctx_t *hashcat_ctx) const time_t time_start = status_ctx->runtime_start; - char buf; + char buf[32] = { 0 }; - char *start = ctime_r (&time_start, &buf); + char *start = ctime_r (&time_start, buf); const size_t start_len = strlen (start); @@ -936,9 +936,9 @@ char *status_get_time_estimated_absolute (const hashcat_ctx_t *hashcat_ctx) now += sec_etc; - char buf; + char buf[32] = { 0 }; - char *etc = ctime_r (&now, &buf); + char *etc = ctime_r (&now, buf); const size_t etc_len = strlen (etc); diff --git a/src/terminal.c b/src/terminal.c index b09fc35c9..a59949bf4 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -70,10 +70,10 @@ void goodbye_screen (hashcat_ctx_t *hashcat_ctx, const time_t proc_start, const if (user_options->show == true) return; if (user_options->left == true) return; - char start_buf, stop_buf; + char start_buf[32], stop_buf[32]; - event_log_info_nn (hashcat_ctx, "Started: %s", ctime_r (&proc_start, &start_buf)); - event_log_info_nn (hashcat_ctx, "Stopped: %s", ctime_r (&proc_stop, &stop_buf)); + event_log_info_nn (hashcat_ctx, "Started: %s", ctime_r (&proc_start, start_buf)); + event_log_info_nn (hashcat_ctx, "Stopped: %s", ctime_r (&proc_stop, stop_buf)); } int setup_console ()