From 1703d24c1a0d150359e2a6799dbf90ebfdf7a64f Mon Sep 17 00:00:00 2001 From: Gabriele Gristina Date: Sat, 19 Jun 2021 20:46:09 +0200 Subject: [PATCH] hide fan speed from hwmon output if not detected --- docs/credits.txt | 2 +- src/ext_iokit.c | 2 +- src/hwmon.c | 7 ------- src/terminal.c | 2 +- 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/docs/credits.txt b/docs/credits.txt index 9a4a17716..002014c51 100644 --- a/docs/credits.txt +++ b/docs/credits.txt @@ -22,7 +22,7 @@ Gabriele "matrix" Gristina (@gm4tr1x) * Compressed wordlist feature * OpenCL Info feature * Apple macOS port -* Hardware monitor initial code base +* Hardware monitor initial code base and maintenance * Test suite initial code base * Makefile initial code base * Multithreading initial code base diff --git a/src/ext_iokit.c b/src/ext_iokit.c index 19ec6c3a6..12de48069 100644 --- a/src/ext_iokit.c +++ b/src/ext_iokit.c @@ -270,7 +270,7 @@ int hm_IOKIT_get_fan_speed_current (void *hashcat_ctx, char *fan_speed_buf) // remove last two bytes size_t out_len = strlen (fan_speed_buf); - fan_speed_buf[out_len-2] = '\0'; + if (out_len > 2) fan_speed_buf[out_len-2] = '\0'; } return 1; diff --git a/src/hwmon.c b/src/hwmon.c index a38c74c27..093b7b3bd 100644 --- a/src/hwmon.c +++ b/src/hwmon.c @@ -1408,13 +1408,6 @@ int hwmon_ctx_init (hashcat_ctx_t *hashcat_ctx) hwmon_ctx->hm_iokit = NULL; } - - if (hwmon_ctx->hm_adl) - { - hcfree (hwmon_ctx->hm_iokit); - - hwmon_ctx->hm_iokit = NULL; - } } #endif diff --git a/src/terminal.c b/src/terminal.c index 48ae37757..7fee3f166 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -1796,7 +1796,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx) if (device_info->hwmon_dev == NULL) continue; #if defined(__APPLE__) - if (first_dev && device_info->hwmon_fan_dev) + if (first_dev && strlen (device_info->hwmon_fan_dev) > 0) { event_log_info (hashcat_ctx, "Hardware.Mon.SMC.: %s", device_info->hwmon_fan_dev); first_dev = false;