mirror of
https://github.com/hashcat/hashcat.git
synced 2025-01-24 14:41:16 +00:00
Merge pull request #3719 from matrix/fix_sprintf_iokit
Hardware Monitor: avoid sprintf in src/ext_iokit.c
This commit is contained in:
commit
f840574aab
@ -91,6 +91,7 @@
|
|||||||
- SecureCRT MasterPassphrase v2: update module, pure kernels and test unit. Add optimized kernels.
|
- SecureCRT MasterPassphrase v2: update module, pure kernels and test unit. Add optimized kernels.
|
||||||
- Metal Backend: added workaround to prevent 'Infinite Loop' bug when build kernels
|
- Metal Backend: added workaround to prevent 'Infinite Loop' bug when build kernels
|
||||||
- User Options: added --metal-compiler-runtime option
|
- User Options: added --metal-compiler-runtime option
|
||||||
|
- Hardware Monitor: avoid sprintf in src/ext_iokit.c
|
||||||
- Help: show supported hash-modes only with -hh
|
- Help: show supported hash-modes only with -hh
|
||||||
|
|
||||||
* changes v6.2.5 -> v6.2.6
|
* changes v6.2.5 -> v6.2.6
|
||||||
|
@ -37,7 +37,7 @@ void hm_IOKIT_ultostr (char *str, UInt32 val)
|
|||||||
{
|
{
|
||||||
str[0] = '\0';
|
str[0] = '\0';
|
||||||
|
|
||||||
sprintf (str, "%c%c%c%c", (unsigned int) (val >> 24), (unsigned int) (val >> 16), (unsigned int) (val >> 8), (unsigned int) (val));
|
snprintf (str, 5, "%c%c%c%c", (unsigned int) (val >> 24), (unsigned int) (val >> 16), (unsigned int) (val >> 8), (unsigned int) (val));
|
||||||
}
|
}
|
||||||
|
|
||||||
kern_return_t hm_IOKIT_SMCOpen (void *hashcat_ctx, io_connect_t *conn)
|
kern_return_t hm_IOKIT_SMCOpen (void *hashcat_ctx, io_connect_t *conn)
|
||||||
@ -301,6 +301,9 @@ int hm_IOKIT_get_fan_speed_current (void *hashcat_ctx, char *fan_speed_buf)
|
|||||||
|
|
||||||
if (totalFans <= 0) return -1;
|
if (totalFans <= 0) return -1;
|
||||||
|
|
||||||
|
// limit totalFans to 10
|
||||||
|
if (totalFans > 10) totalFans = 10;
|
||||||
|
|
||||||
char tmp_buf[16];
|
char tmp_buf[16];
|
||||||
|
|
||||||
for (int i = 0; i < totalFans; i++)
|
for (int i = 0; i < totalFans; i++)
|
||||||
@ -310,12 +313,12 @@ int hm_IOKIT_get_fan_speed_current (void *hashcat_ctx, char *fan_speed_buf)
|
|||||||
float maximum_speed = 0.0f;
|
float maximum_speed = 0.0f;
|
||||||
|
|
||||||
memset (&key, 0, sizeof (UInt32Char_t));
|
memset (&key, 0, sizeof (UInt32Char_t));
|
||||||
sprintf (key, "F%dAc", i);
|
snprintf (key, 5, "F%dAc", i);
|
||||||
hm_IOKIT_SMCGetFanRPM (key, iokit->conn, &actual_speed);
|
hm_IOKIT_SMCGetFanRPM (key, iokit->conn, &actual_speed);
|
||||||
if (actual_speed < 0.f) continue;
|
if (actual_speed < 0.f) continue;
|
||||||
|
|
||||||
memset (&key, 0, sizeof (UInt32Char_t));
|
memset (&key, 0, sizeof (UInt32Char_t));
|
||||||
sprintf (key, "F%dMx", i);
|
snprintf (key, 5, "F%dMx", i);
|
||||||
hm_IOKIT_SMCGetFanRPM (key, iokit->conn, &maximum_speed);
|
hm_IOKIT_SMCGetFanRPM (key, iokit->conn, &maximum_speed);
|
||||||
if (maximum_speed < 0.f) continue;
|
if (maximum_speed < 0.f) continue;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user