From caf34e0e83d1d622c2236dc81ceadd40882d7c38 Mon Sep 17 00:00:00 2001 From: Gabriele Gristina Date: Sat, 29 Jun 2019 17:49:57 +0200 Subject: [PATCH] Fix some *print* format arguments --- src/backend.c | 6 +++--- src/brain.c | 2 +- src/modules/module_06800.c | 2 +- src/modules/module_09700.c | 2 +- src/modules/module_09710.c | 2 +- src/modules/module_09720.c | 2 +- src/modules/module_09800.c | 2 +- src/modules/module_09810.c | 2 +- src/modules/module_09820.c | 2 +- src/modules/module_15900.c | 2 +- src/modules/module_16600.c | 2 +- src/modules/module_18400.c | 2 +- src/modules/module_18600.c | 2 +- src/modules/module_19000.c | 2 +- src/modules/module_19100.c | 2 +- src/modules/module_19200.c | 2 +- src/usage.c | 2 +- 17 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/backend.c b/src/backend.c index 9829efa5c..ceb3070a3 100644 --- a/src/backend.c +++ b/src/backend.c @@ -6318,7 +6318,7 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) int opencl_driver3 = 0; int opencl_driver4 = 0; - const int res18 = sscanf (device_param->opencl_driver_version, "%u.%u.%u.%u", &opencl_driver1, &opencl_driver2, &opencl_driver3, &opencl_driver4); + const int res18 = sscanf (device_param->opencl_driver_version, "%d.%d.%d.%d", &opencl_driver1, &opencl_driver2, &opencl_driver3, &opencl_driver4); if (res18 == 4) { @@ -7429,9 +7429,9 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) // we don't have sm_* on vendors not NV but it doesn't matter #if defined (DEBUG) - build_options_len += snprintf (build_options_buf + build_options_len, build_options_sz - build_options_len, "-D LOCAL_MEM_TYPE=%u -D VENDOR_ID=%u -D CUDA_ARCH=%u -D HAS_VPERM=%u -D HAS_VADD3=%u -D HAS_VBFE=%u -D HAS_BFE=%u -D HAS_LOP3=%u -D HAS_MOV64=%u -D HAS_PRMT=%u -D VECT_SIZE=%u -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_TYPE=%u -D ATTACK_EXEC=%u -D ATTACK_KERN=%u -D _unroll ", device_param->device_local_mem_type, device_param->opencl_platform_vendor_id, (device_param->sm_major * 100) + (device_param->sm_minor * 10), device_param->has_vperm, device_param->has_vadd3, device_param->has_vbfe, device_param->has_bfe, device_param->has_lop3, device_param->has_mov64, device_param->has_prmt, device_param->vector_width, (u32) device_param->opencl_device_type, hashconfig->dgst_pos0, hashconfig->dgst_pos1, hashconfig->dgst_pos2, hashconfig->dgst_pos3, hashconfig->dgst_size / 4, kern_type, hashconfig->attack_exec, user_options_extra->attack_kern); + build_options_len += snprintf (build_options_buf + build_options_len, build_options_sz - build_options_len, "-D LOCAL_MEM_TYPE=%d -D VENDOR_ID=%u -D CUDA_ARCH=%u -D HAS_VPERM=%u -D HAS_VADD3=%u -D HAS_VBFE=%u -D HAS_BFE=%u -D HAS_LOP3=%u -D HAS_MOV64=%u -D HAS_PRMT=%u -D VECT_SIZE=%d -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_TYPE=%u -D ATTACK_EXEC=%u -D ATTACK_KERN=%u -D _unroll ", device_param->device_local_mem_type, device_param->opencl_platform_vendor_id, (device_param->sm_major * 100) + (device_param->sm_minor * 10), device_param->has_vperm, device_param->has_vadd3, device_param->has_vbfe, device_param->has_bfe, device_param->has_lop3, device_param->has_mov64, device_param->has_prmt, device_param->vector_width, (u32) device_param->opencl_device_type, hashconfig->dgst_pos0, hashconfig->dgst_pos1, hashconfig->dgst_pos2, hashconfig->dgst_pos3, hashconfig->dgst_size / 4, kern_type, hashconfig->attack_exec, user_options_extra->attack_kern); #else - build_options_len += snprintf (build_options_buf + build_options_len, build_options_sz - build_options_len, "-D LOCAL_MEM_TYPE=%u -D VENDOR_ID=%u -D CUDA_ARCH=%u -D HAS_VPERM=%u -D HAS_VADD3=%u -D HAS_VBFE=%u -D HAS_BFE=%u -D HAS_LOP3=%u -D HAS_MOV64=%u -D HAS_PRMT=%u -D VECT_SIZE=%u -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_TYPE=%u -D ATTACK_EXEC=%u -D ATTACK_KERN=%u -D _unroll -w ", device_param->device_local_mem_type, device_param->opencl_platform_vendor_id, (device_param->sm_major * 100) + (device_param->sm_minor * 10), device_param->has_vperm, device_param->has_vadd3, device_param->has_vbfe, device_param->has_bfe, device_param->has_lop3, device_param->has_mov64, device_param->has_prmt, device_param->vector_width, (u32) device_param->opencl_device_type, hashconfig->dgst_pos0, hashconfig->dgst_pos1, hashconfig->dgst_pos2, hashconfig->dgst_pos3, hashconfig->dgst_size / 4, kern_type, hashconfig->attack_exec, user_options_extra->attack_kern); + build_options_len += snprintf (build_options_buf + build_options_len, build_options_sz - build_options_len, "-D LOCAL_MEM_TYPE=%d -D VENDOR_ID=%u -D CUDA_ARCH=%u -D HAS_VPERM=%u -D HAS_VADD3=%u -D HAS_VBFE=%u -D HAS_BFE=%u -D HAS_LOP3=%u -D HAS_MOV64=%u -D HAS_PRMT=%u -D VECT_SIZE=%d -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_TYPE=%u -D ATTACK_EXEC=%u -D ATTACK_KERN=%u -D _unroll -w ", device_param->device_local_mem_type, device_param->opencl_platform_vendor_id, (device_param->sm_major * 100) + (device_param->sm_minor * 10), device_param->has_vperm, device_param->has_vadd3, device_param->has_vbfe, device_param->has_bfe, device_param->has_lop3, device_param->has_mov64, device_param->has_prmt, device_param->vector_width, (u32) device_param->opencl_device_type, hashconfig->dgst_pos0, hashconfig->dgst_pos1, hashconfig->dgst_pos2, hashconfig->dgst_pos3, hashconfig->dgst_size / 4, kern_type, hashconfig->attack_exec, user_options_extra->attack_kern); #endif build_options_buf[build_options_len] = 0; diff --git a/src/brain.c b/src/brain.c index cf286c270..77b7af712 100644 --- a/src/brain.c +++ b/src/brain.c @@ -32,7 +32,7 @@ int brain_logging (FILE *stream, const int client_idx, const char *format, ...) gettimeofday (&v, NULL); - fprintf (stream, "%d.%06d | %6.2fs | %3d | ", (u32) v.tv_sec, (u32) v.tv_usec, ms / 1000, client_idx); + fprintf (stream, "%u.%06u | %6.2fs | %3d | ", (u32) v.tv_sec, (u32) v.tv_usec, ms / 1000, client_idx); va_list ap; diff --git a/src/modules/module_06800.c b/src/modules/module_06800.c index 5b6857966..f90796038 100644 --- a/src/modules/module_06800.c +++ b/src/modules/module_06800.c @@ -154,7 +154,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE tmp_salt[salt_len] = 0; - return snprintf (line_buf, line_size, "%08x%08x%08x%08x:%d:%s", + return snprintf (line_buf, line_size, "%08x%08x%08x%08x:%u:%s", digest[0], digest[1], digest[2], diff --git a/src/modules/module_09700.c b/src/modules/module_09700.c index c2dfdbde8..13f6832a6 100644 --- a/src/modules/module_09700.c +++ b/src/modules/module_09700.c @@ -191,7 +191,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { const oldoffice01_t *oldoffice01 = (const oldoffice01_t *) esalt_buf; - const int line_len = snprintf (line_buf, line_size, "%s%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x", + const int line_len = snprintf (line_buf, line_size, "%s%u*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x", SIGNATURE_OLDOFFICE, oldoffice01->version, byte_swap_32 (salt->salt_buf[0]), diff --git a/src/modules/module_09710.c b/src/modules/module_09710.c index cf50b8d4a..f2f8b662a 100644 --- a/src/modules/module_09710.c +++ b/src/modules/module_09710.c @@ -210,7 +210,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { const oldoffice01_t *oldoffice01 = (const oldoffice01_t *) esalt_buf; - const int line_len = snprintf (line_buf, line_size, "%s%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x", + const int line_len = snprintf (line_buf, line_size, "%s%u*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x", SIGNATURE_OLDOFFICE, oldoffice01->version, byte_swap_32 (salt->salt_buf[0]), diff --git a/src/modules/module_09720.c b/src/modules/module_09720.c index 96eb917e3..c6d86450a 100644 --- a/src/modules/module_09720.c +++ b/src/modules/module_09720.c @@ -204,7 +204,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE const u8 *rc4key = (const u8 *) oldoffice01->rc4key; - const int line_len = snprintf (line_buf, line_size, "%s%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x:%02x%02x%02x%02x%02x", + const int line_len = snprintf (line_buf, line_size, "%s%u*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x:%02x%02x%02x%02x%02x", SIGNATURE_OLDOFFICE, oldoffice01->version, byte_swap_32 (salt->salt_buf[0]), diff --git a/src/modules/module_09800.c b/src/modules/module_09800.c index bca85a59b..b191924dc 100644 --- a/src/modules/module_09800.c +++ b/src/modules/module_09800.c @@ -208,7 +208,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { const oldoffice34_t *oldoffice34 = (const oldoffice34_t *) esalt_buf; - const int line_len = snprintf (line_buf, line_size, "%s%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x", + const int line_len = snprintf (line_buf, line_size, "%s%u*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x", SIGNATURE_OLDOFFICE, oldoffice34->version, salt->salt_buf[0], diff --git a/src/modules/module_09810.c b/src/modules/module_09810.c index b015b19e5..ecbba7c64 100644 --- a/src/modules/module_09810.c +++ b/src/modules/module_09810.c @@ -215,7 +215,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { const oldoffice34_t *oldoffice34 = (const oldoffice34_t *) esalt_buf; - const int line_len = snprintf (line_buf, line_size, "%s%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x", + const int line_len = snprintf (line_buf, line_size, "%s%u*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x", SIGNATURE_OLDOFFICE, oldoffice34->version, salt->salt_buf[0], diff --git a/src/modules/module_09820.c b/src/modules/module_09820.c index ff6b5eba6..fd1aeabc1 100644 --- a/src/modules/module_09820.c +++ b/src/modules/module_09820.c @@ -208,7 +208,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE const u8 *rc4key = (const u8 *) oldoffice34->rc4key; - const int line_len = snprintf (line_buf, line_size, "%s%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x:%02x%02x%02x%02x%02x", + const int line_len = snprintf (line_buf, line_size, "%s%u*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x:%02x%02x%02x%02x%02x", SIGNATURE_OLDOFFICE, oldoffice34->version, salt->salt_buf[0], diff --git a/src/modules/module_15900.c b/src/modules/module_15900.c index 3756fac85..f53679d02 100644 --- a/src/modules/module_15900.c +++ b/src/modules/module_15900.c @@ -374,7 +374,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE memcpy (hash_algorithm, "sha512", strlen ("sha512")); } - const int line_len = snprintf (line_buf, line_size, "%s%d*%d*%s*%s*%s*%d*%s*%d*%s", + const int line_len = snprintf (line_buf, line_size, "%s%u*%u*%s*%s*%s*%u*%s*%u*%s", SIGNATURE_DPAPIMK, version, context, diff --git a/src/modules/module_16600.c b/src/modules/module_16600.c index af548c40b..633901cca 100644 --- a/src/modules/module_16600.c +++ b/src/modules/module_16600.c @@ -165,7 +165,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { const electrum_wallet_t *electrum_wallet = (const electrum_wallet_t *) esalt_buf; - const int line_len = snprintf (line_buf, line_size, "%s%d*%08x%08x%08x%08x*%08x%08x%08x%08x", + const int line_len = snprintf (line_buf, line_size, "%s%u*%08x%08x%08x%08x*%08x%08x%08x%08x", SIGNATURE_ELECTRUM_WALLET, electrum_wallet->salt_type, byte_swap_32 (electrum_wallet->iv[0]), diff --git a/src/modules/module_18400.c b/src/modules/module_18400.c index 84e7d6ccb..e40331bb0 100644 --- a/src/modules/module_18400.c +++ b/src/modules/module_18400.c @@ -247,7 +247,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { const odf12_t *odf12 = (const odf12_t *) esalt_buf; - int out_len = snprintf (line_buf, line_size, "%s*1*1*%d*32*%08x%08x%08x%08x%08x%08x%08x%08x*16*%08x%08x%08x%08x*16*%08x%08x%08x%08x*0*", + int out_len = snprintf (line_buf, line_size, "%s*1*1*%u*32*%08x%08x%08x%08x%08x%08x%08x%08x*16*%08x%08x%08x%08x*16*%08x%08x%08x%08x*0*", SIGNATURE_ODF, odf12->iterations, byte_swap_32 (odf12->checksum[0]), diff --git a/src/modules/module_18600.c b/src/modules/module_18600.c index 9feba23fb..75ce00c9f 100644 --- a/src/modules/module_18600.c +++ b/src/modules/module_18600.c @@ -312,7 +312,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { const odf11_t *odf11 = (const odf11_t *) esalt_buf; - int out_len = snprintf (line_buf, line_size, "%s*0*0*%d*16*%08x%08x%08x%08x%08x*8*%08x%08x*16*%08x%08x%08x%08x*0*", + int out_len = snprintf (line_buf, line_size, "%s*0*0*%u*16*%08x%08x%08x%08x%08x*8*%08x%08x*16*%08x%08x%08x%08x*0*", SIGNATURE_ODF, odf11->iterations, byte_swap_32 (odf11->checksum[0]), diff --git a/src/modules/module_19000.c b/src/modules/module_19000.c index e462b9647..6a742c8e6 100644 --- a/src/modules/module_19000.c +++ b/src/modules/module_19000.c @@ -154,7 +154,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE line_buf[line_len++] = 'm'; line_buf[line_len++] = ','; - line_len += snprintf (line_buf + line_len, line_size - line_len, "%u", iter); + line_len += snprintf (line_buf + line_len, line_size - line_len, "%d", iter); line_buf[line_len++] = '@'; } diff --git a/src/modules/module_19100.c b/src/modules/module_19100.c index 0bd87b659..c8ef5add7 100644 --- a/src/modules/module_19100.c +++ b/src/modules/module_19100.c @@ -180,7 +180,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE line_buf[line_len++] = 's'; line_buf[line_len++] = ','; - line_len += snprintf (line_buf + line_len, line_size - line_len, "%u", iter); + line_len += snprintf (line_buf + line_len, line_size - line_len, "%d", iter); line_buf[line_len++] = '@'; } diff --git a/src/modules/module_19200.c b/src/modules/module_19200.c index 5b3e7f610..affe045ca 100644 --- a/src/modules/module_19200.c +++ b/src/modules/module_19200.c @@ -182,7 +182,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE line_buf[line_len++] = 'S'; line_buf[line_len++] = ','; - line_len += snprintf (line_buf + line_len, line_size - line_len, "%u", iter); + line_len += snprintf (line_buf + line_len, line_size - line_len, "%d", iter); line_buf[line_len++] = '@'; } diff --git a/src/usage.c b/src/usage.c index 02cf4b179..ce7769700 100644 --- a/src/usage.c +++ b/src/usage.c @@ -322,7 +322,7 @@ void usage_big_print (hashcat_ctx_t *hashcat_ctx) for (int i = 0; i < usage_sort_cnt; i++) { - printf ("%7d | %-48s | %s", usage_sort_buf[i].hash_mode, usage_sort_buf[i].hash_name, strhashcategory (usage_sort_buf[i].hash_category)); + printf ("%7u | %-48s | %s", usage_sort_buf[i].hash_mode, usage_sort_buf[i].hash_name, strhashcategory (usage_sort_buf[i].hash_category)); hc_fwrite (EOL, strlen (EOL), 1, stdout); }