diff --git a/src/hwmon.c b/src/hwmon.c index a4c0338f5..ed8374e60 100644 --- a/src/hwmon.c +++ b/src/hwmon.c @@ -2274,7 +2274,7 @@ static int get_adapters_num_adl (hashcat_ctx_t *hashcat_ctx, int *iNumberAdapter if (hm_rc == -1) return -1; - if (iNumberAdapters == 0) + if (iNumberAdapters == NULL) { event_log_error (hashcat_ctx, "No ADL adapters found"); diff --git a/src/interface.c b/src/interface.c index e632d87b6..8745e00ef 100644 --- a/src/interface.c +++ b/src/interface.c @@ -13486,7 +13486,7 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const u32 salt_pos, } else { - snprintf (out_buf, len-1, "$1$rounds=%i$%s$%s", salt.salt_iter, (char *) salt.salt_buf, (char *) ptr_plain); + snprintf (out_buf, len-1, "$1$rounds=%u$%s$%s", salt.salt_iter, (char *) salt.salt_buf, (char *) ptr_plain); } } else if (hash_mode == 501) @@ -13585,7 +13585,7 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const u32 salt_pos, } else { - snprintf (out_buf, len-1, "$apr1$rounds=%i$%s$%s", salt.salt_iter, (char *) salt.salt_buf, (char *) ptr_plain); + snprintf (out_buf, len-1, "$apr1$rounds=%u$%s$%s", salt.salt_iter, (char *) salt.salt_buf, (char *) ptr_plain); } } else if (hash_mode == 1711) @@ -13659,14 +13659,14 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const u32 salt_pos, } else { - snprintf (out_buf, len-1, "$6$rounds=%i$%s$%s", salt.salt_iter, (char *) salt.salt_buf, (char *) ptr_plain); + snprintf (out_buf, len-1, "$6$rounds=%u$%s$%s", salt.salt_iter, (char *) salt.salt_buf, (char *) ptr_plain); } } else if (hash_mode == 2100) { u32 pos = 0; - snprintf (out_buf + pos, len-1, "%s%i#", + snprintf (out_buf + pos, len-1, "%s%u#", SIGNATURE_DCC2, salt.salt_iter + 1); @@ -14079,13 +14079,13 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const u32 salt_pos, { sha256aix_encode ((unsigned char *) digest_buf, (unsigned char *) ptr_plain); - snprintf (out_buf, len-1, "{ssha256}%02d$%s$%s", salt.salt_sign[0], (char *) salt.salt_buf, (char *) ptr_plain); + snprintf (out_buf, len-1, "{ssha256}%02u$%s$%s", salt.salt_sign[0], (char *) salt.salt_buf, (char *) ptr_plain); } else if (hash_mode == 6500) { sha512aix_encode ((unsigned char *) digest_buf64, (unsigned char *) ptr_plain); - snprintf (out_buf, len-1, "{ssha512}%02d$%s$%s", salt.salt_sign[0], (char *) salt.salt_buf, (char *) ptr_plain); + snprintf (out_buf, len-1, "{ssha512}%02u$%s$%s", salt.salt_sign[0], (char *) salt.salt_buf, (char *) ptr_plain); } else if (hash_mode == 6600) { @@ -14098,7 +14098,7 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const u32 salt_pos, u32 buf_len = len - 1; - u32 off = snprintf (out_buf, buf_len, "%d:%08x%08x:", salt.salt_iter + 1, salt.salt_buf[0], salt.salt_buf[1]); + u32 off = snprintf (out_buf, buf_len, "%u:%08x%08x:", salt.salt_iter + 1, salt.salt_buf[0], salt.salt_buf[1]); buf_len -= 22; for (u32 i = 0, j = off; i < 1040; i++, j += 2) @@ -14112,7 +14112,7 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const u32 salt_pos, { sha1aix_encode ((unsigned char *) digest_buf, (unsigned char *) ptr_plain); - snprintf (out_buf, len-1, "{ssha1}%02d$%s$%s", salt.salt_sign[0], (char *) salt.salt_buf, (char *) ptr_plain); + snprintf (out_buf, len-1, "{ssha1}%02u$%s$%s", salt.salt_sign[0], (char *) salt.salt_buf, (char *) ptr_plain); } else if (hash_mode == 6800) { @@ -14137,7 +14137,7 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const u32 salt_pos, esalt[6] = byte_swap_32 (pbkdf2_sha512->salt_buf[6]); esalt[7] = byte_swap_32 (pbkdf2_sha512->salt_buf[7]); - snprintf (out_buf, len-1, "%s%i$%08x%08x%08x%08x%08x%08x%08x%08x$%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", + snprintf (out_buf, len-1, "%s%u$%08x%08x%08x%08x%08x%08x%08x%08x$%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", SIGNATURE_SHA512OSX, salt.salt_iter + 1, esalt[ 0], esalt[ 1], @@ -14163,7 +14163,7 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const u32 salt_pos, u32 len_used = 0; - snprintf (out_buf + len_used, len - len_used - 1, "%s%i.", SIGNATURE_SHA512GRUB, salt.salt_iter + 1); + snprintf (out_buf + len_used, len - len_used - 1, "%s%u.", SIGNATURE_SHA512GRUB, salt.salt_iter + 1); len_used = strlen (out_buf); @@ -14223,7 +14223,7 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const u32 salt_pos, } else { - snprintf (out_buf, len-1, "$5$rounds=%i$%s$%s", salt.salt_iter, (char *) salt.salt_buf, (char *) ptr_plain); + snprintf (out_buf, len-1, "$5$rounds=%u$%s$%s", salt.salt_iter, (char *) salt.salt_buf, (char *) ptr_plain); } } else if (hash_mode == 7500) @@ -14793,7 +14793,7 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const u32 salt_pos, // output - snprintf (out_buf, len-1, "%s%i$%s$%s", SIGNATURE_DJANGOPBKDF2, salt.salt_iter + 1, salt_buf_ptr, tmp_buf); + snprintf (out_buf, len-1, "%s%u$%s$%s", SIGNATURE_DJANGOPBKDF2, salt.salt_iter + 1, salt_buf_ptr, tmp_buf); } else if (hash_mode == 10100) { @@ -14847,7 +14847,7 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const u32 salt_pos, base64_encode (int_to_base64, (const u8 *) tmp_buf, tmp_len, (u8 *) base64_encoded); - snprintf (out_buf, len-1, "%s%i}%s", SIGNATURE_SAPH_SHA1, salt.salt_iter + 1, base64_encoded); + snprintf (out_buf, len-1, "%s%u}%s", SIGNATURE_SAPH_SHA1, salt.salt_iter + 1, base64_encoded); } else if (hash_mode == 10400) { @@ -15139,7 +15139,7 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const u32 salt_pos, sprintf (public_key_buf + j, "%02x", ptr[i]); } - snprintf (out_buf, len-1, "%s%d$%s$%d$%s$%d$%d$%s$%d$%s", + snprintf (out_buf, len-1, "%s%u$%s$%u$%s$%u$%u$%s$%u$%s", SIGNATURE_BITCOIN_WALLET, cry_master_len * 2, cry_master_buf, @@ -15361,7 +15361,7 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const u32 salt_pos, { const u8 *ptr = (const u8 *) salt.salt_buf; - snprintf (out_buf, len-1, "%s,%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x,%d,%08x%08x%08x%08x%08x%08x%08x%08x", + snprintf (out_buf, len-1, "%s,%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x,%u,%08x%08x%08x%08x%08x%08x%08x%08x", SIGNATURE_MS_DRSR, ptr[0], ptr[1], @@ -15459,7 +15459,7 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const u32 salt_pos, } else if (hash_mode == 13200) { - snprintf (out_buf, len-1, "%s*%d*%08x%08x%08x%08x*%08x%08x%08x%08x%08x%08x", + snprintf (out_buf, len-1, "%s*%u*%08x%08x%08x%08x*%08x%08x%08x%08x%08x%08x", SIGNATURE_AXCRYPT, salt.salt_iter, salt.salt_buf[0], @@ -15955,7 +15955,7 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const u32 salt_pos, // iteration - snprintf (buf + 16, 11, "%010i", salt.salt_iter + 1); + snprintf (buf + 16, 11, "%010u", salt.salt_iter + 1); // chars diff --git a/src/opencl.c b/src/opencl.c index 05a27ff03..bc700d72f 100644 --- a/src/opencl.c +++ b/src/opencl.c @@ -60,7 +60,7 @@ static int ocl_check_dri (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx) if (fd_drm == NULL) return 0; - int vendor = 0; + u32 vendor = 0; if (fscanf (fd_drm, "0x%x", &vendor) != 1) return 0; @@ -3772,7 +3772,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) } else if (opencl_ctx->force_jit_compilation == 8900) { - snprintf (build_opts_update, sizeof (build_opts_update) - 1, "%s -DSCRYPT_N=%u -DSCRYPT_R=%u -DSCRYPT_P=%u -DSCRYPT_TMTO=%u -DSCRYPT_TMP_ELEM=%u", build_opts, hashes->salts_buf[0].scrypt_N, hashes->salts_buf[0].scrypt_r, hashes->salts_buf[0].scrypt_p, 1 << scrypt_tmto_final, scrypt_tmp_size / 16); + snprintf (build_opts_update, sizeof (build_opts_update) - 1, "%s -DSCRYPT_N=%u -DSCRYPT_R=%u -DSCRYPT_P=%u -DSCRYPT_TMTO=%u -DSCRYPT_TMP_ELEM=%u", build_opts, hashes->salts_buf[0].scrypt_N, hashes->salts_buf[0].scrypt_r, hashes->salts_buf[0].scrypt_p, 1u << scrypt_tmto_final, scrypt_tmp_size / 16); } else { @@ -4350,19 +4350,19 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) { if (hashconfig->opti_type & OPTI_TYPE_SINGLE_HASH) { - snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05d_s%02d", hashconfig->kern_type, 4); + snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_s%02d", hashconfig->kern_type, 4); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel1); if (CL_rc == -1) return -1; - snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05d_s%02d", hashconfig->kern_type, 8); + snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_s%02d", hashconfig->kern_type, 8); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel2); if (CL_rc == -1) return -1; - snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05d_s%02d", hashconfig->kern_type, 16); + snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_s%02d", hashconfig->kern_type, 16); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel3); @@ -4370,19 +4370,19 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) } else { - snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05d_m%02d", hashconfig->kern_type, 4); + snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_m%02d", hashconfig->kern_type, 4); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel1); if (CL_rc == -1) return -1; - snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05d_m%02d", hashconfig->kern_type, 8); + snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_m%02d", hashconfig->kern_type, 8); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel2); if (CL_rc == -1) return -1; - snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05d_m%02d", hashconfig->kern_type, 16); + snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_m%02d", hashconfig->kern_type, 16); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel3); @@ -4393,7 +4393,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) { if (hashconfig->opts_type & OPTS_TYPE_PT_BITSLICE) { - snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05d_tm", hashconfig->kern_type); + snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_tm", hashconfig->kern_type); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel_tm); @@ -4409,7 +4409,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) { // kernel1 - snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05d_init", hashconfig->kern_type); + snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_init", hashconfig->kern_type); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel1); @@ -4417,7 +4417,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) // kernel2 - snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05d_loop", hashconfig->kern_type); + snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_loop", hashconfig->kern_type); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel2); @@ -4425,7 +4425,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) // kernel3 - snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05d_comp", hashconfig->kern_type); + snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_comp", hashconfig->kern_type); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel3); @@ -4435,7 +4435,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) if (hashconfig->opts_type & OPTS_TYPE_HOOK12) { - snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05d_hook12", hashconfig->kern_type); + snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_hook12", hashconfig->kern_type); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel12); @@ -4450,7 +4450,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) if (hashconfig->opts_type & OPTS_TYPE_HOOK23) { - snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05d_hook23", hashconfig->kern_type); + snprintf (kernel_name, sizeof (kernel_name) - 1, "m%05u_hook23", hashconfig->kern_type); CL_rc = hc_clCreateKernel (hashcat_ctx, device_param->program, kernel_name, &device_param->kernel23); diff --git a/src/restore.c b/src/restore.c index f6184ea1d..6316f2290 100644 --- a/src/restore.c +++ b/src/restore.c @@ -50,7 +50,7 @@ static int check_running_process (hashcat_ctx_t *hashcat_ctx) int pidbin_len = -1; #if defined (_POSIX) - snprintf (pidbin, HCBUFSIZ_LARGE - 1, "/proc/%d/cmdline", rd->pid); + snprintf (pidbin, HCBUFSIZ_LARGE - 1, "/proc/%u/cmdline", rd->pid); FILE *fd = fopen (pidbin, "rb"); diff --git a/src/terminal.c b/src/terminal.c index 36c20c5e4..155a8261a 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -600,7 +600,7 @@ void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx) return; } - printf ("STATUS\t%u\t", hashcat_status->status_number); + printf ("STATUS\t%d\t", hashcat_status->status_number); printf ("SPEED\t"); @@ -631,9 +631,9 @@ void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx) printf ("PROGRESS\t%" PRIu64 "\t%" PRIu64 "\t", hashcat_status->progress_cur_relative_skip, hashcat_status->progress_end_relative_skip); - printf ("RECHASH\t%u\t%u\t", hashcat_status->digests_done, hashcat_status->digests_cnt); + printf ("RECHASH\t%d\t%d\t", hashcat_status->digests_done, hashcat_status->digests_cnt); - printf ("RECSALT\t%u\t%u\t", hashcat_status->salts_done, hashcat_status->salts_cnt); + printf ("RECSALT\t%d\t%d\t", hashcat_status->salts_done, hashcat_status->salts_cnt); if (user_options->gpu_temp_disable == false) {