From 0642639b818f175b0486a56bc49ba9b0895b3046 Mon Sep 17 00:00:00 2001 From: jsteube Date: Tue, 14 Feb 2017 21:21:24 +0100 Subject: [PATCH] CID 1402417 (#1 of 1): Division or modulo by float zero --- src/status.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/status.c b/src/status.c index e449ddea8..868d3708a 100644 --- a/src/status.c +++ b/src/status.c @@ -539,6 +539,8 @@ double status_get_input_base_percent (const hashcat_ctx_t *hashcat_ctx) const int input_base_offset = status_get_input_base_offset (hashcat_ctx); const int input_base_count = status_get_input_base_count (hashcat_ctx); + if (input_base_count == 0) return 0; + return ((double) input_base_offset / (double) input_base_count) * 100; } @@ -652,6 +654,8 @@ double status_get_input_mod_percent (const hashcat_ctx_t *hashcat_ctx) const int input_mod_offset = status_get_input_mod_offset (hashcat_ctx); const int input_mod_count = status_get_input_mod_count (hashcat_ctx); + if (input_mod_count == 0) return 0; + return ((double) input_mod_offset / (double) input_mod_count) * 100; } @@ -783,6 +787,8 @@ double status_get_digests_percent (const hashcat_ctx_t *hashcat_ctx) { const hashes_t *hashes = hashcat_ctx->hashes; + if (hashes->digests_cnt == 0) return 0; + return ((double) hashes->digests_done / (double) hashes->digests_cnt) * 100; } @@ -804,6 +810,8 @@ double status_get_salts_percent (const hashcat_ctx_t *hashcat_ctx) { const hashes_t *hashes = hashcat_ctx->hashes; + if (hashes->salts_cnt == 0) return 0; + return ((double) hashes->salts_done / (double) hashes->salts_cnt) * 100; }