1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-23 16:38:29 +00:00

Merge pull request #1044 from neheb/master

Fix more cppcheck warnings
This commit is contained in:
Jens Steube 2017-02-11 12:04:16 +01:00 committed by GitHub
commit 6cf3763eb5
6 changed files with 17 additions and 20 deletions

View File

@ -75,6 +75,8 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
{ {
event_log_error (hashcat_ctx, "%s: %s", dictfile2, strerror (errno)); event_log_error (hashcat_ctx, "%s: %s", dictfile2, strerror (errno));
fclose (fp1);
return -1; return -1;
} }

View File

@ -256,8 +256,6 @@ char **scan_directory (const char *path)
files[num_files] = NULL; files[num_files] = NULL;
num_files++;
hcfree (tmp_path); hcfree (tmp_path);
return (files); return (files);

View File

@ -573,8 +573,8 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
* load hashes, part II: allocate required memory, set pointers * load hashes, part II: allocate required memory, set pointers
*/ */
hash_t *hashes_buf = NULL; hash_t *hashes_buf;
void *digests_buf = NULL; void *digests_buf;
salt_t *salts_buf = NULL; salt_t *salts_buf = NULL;
void *esalts_buf = NULL; void *esalts_buf = NULL;
void *hook_salts_buf = NULL; void *hook_salts_buf = NULL;
@ -758,7 +758,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
while (!feof (fp)) while (!feof (fp))
{ {
const int nread = fread (in, sizeof (hccapx_t), 1, fp); const size_t nread = fread (in, sizeof (hccapx_t), 1, fp);
if (nread == 0) break; if (nread == 0) break;

View File

@ -571,6 +571,8 @@ static int nvml_init (hashcat_ctx_t *hashcat_ctx)
fread (nvml_winpath, 100, 1, nvml_lib); fread (nvml_winpath, 100, 1, nvml_lib);
fclose (nvml_lib);
ssize_t size = cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_PROC_CYGDRIVE, nvml_winpath, NULL, 0); ssize_t size = cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_PROC_CYGDRIVE, nvml_winpath, NULL, 0);
if (size > 0) if (size > 0)

View File

@ -12275,9 +12275,6 @@ int axcrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN
if (salt_len != 32) return (PARSER_SALT_LENGTH); if (salt_len != 32) return (PARSER_SALT_LENGTH);
/* Skip '*' */
wrapped_key_pos++;
u32 wrapped_key_len = input_len - 11 - 1 - wrapping_rounds_len - 1 - salt_len - 1; u32 wrapped_key_len = input_len - 11 - 1 - wrapping_rounds_len - 1 - salt_len - 1;
if (wrapped_key_len != 48) return (PARSER_SALT_LENGTH); if (wrapped_key_len != 48) return (PARSER_SALT_LENGTH);
@ -13120,8 +13117,6 @@ int zip2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSE
u32 param7_len = param8_pos - param7_pos; u32 param7_len = param8_pos - param7_pos;
param8_pos++;
const u32 type = atoll ((const char *) param0_pos); const u32 type = atoll ((const char *) param0_pos);
const u32 mode = atoll ((const char *) param1_pos); const u32 mode = atoll ((const char *) param1_pos);
const u32 magic = atoll ((const char *) param2_pos); const u32 magic = atoll ((const char *) param2_pos);
@ -13428,7 +13423,7 @@ int luks_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSE
struct luks_phdr hdr; struct luks_phdr hdr;
const int nread = fread (&hdr, sizeof (hdr), 1, fp); const size_t nread = fread (&hdr, sizeof (hdr), 1, fp);
if (nread != 1) return (PARSER_LUKS_FILE_SIZE); if (nread != 1) return (PARSER_LUKS_FILE_SIZE);
@ -13637,23 +13632,23 @@ int luks_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSE
const u32 keyMaterialOffset = byte_swap_32 (hdr.keyblock[keyslot_idx].keyMaterialOffset); const u32 keyMaterialOffset = byte_swap_32 (hdr.keyblock[keyslot_idx].keyMaterialOffset);
const int rc_seek1 = fseek (fp, keyMaterialOffset * 512, SEEK_SET); const int rc_seek1 = fseeko (fp, keyMaterialOffset * 512, SEEK_SET);
if (rc_seek1 == -1) return (PARSER_LUKS_FILE_SIZE); if (rc_seek1 == -1) return (PARSER_LUKS_FILE_SIZE);
const int nread2 = fread (luks->af_src_buf, keyBytes, stripes, fp); const size_t nread2 = fread (luks->af_src_buf, keyBytes, stripes, fp);
if (nread2 != (int) stripes) return (PARSER_LUKS_FILE_SIZE); if (nread2 != stripes) return (PARSER_LUKS_FILE_SIZE);
// finally, copy some encrypted payload data for entropy check // finally, copy some encrypted payload data for entropy check
const u32 payloadOffset = byte_swap_32 (hdr.payloadOffset); const u32 payloadOffset = byte_swap_32 (hdr.payloadOffset);
const int rc_seek2 = fseek (fp, payloadOffset * 512, SEEK_SET); const int rc_seek2 = fseeko (fp, payloadOffset * 512, SEEK_SET);
if (rc_seek2 == -1) return (PARSER_LUKS_FILE_SIZE); if (rc_seek2 == -1) return (PARSER_LUKS_FILE_SIZE);
const int nread3 = fread (luks->ct_buf, sizeof (u32), 128, fp); const size_t nread3 = fread (luks->ct_buf, sizeof (u32), 128, fp);
if (nread3 != 128) return (PARSER_LUKS_FILE_SIZE); if (nread3 != 128) return (PARSER_LUKS_FILE_SIZE);
@ -14728,7 +14723,7 @@ int check_old_hccap (const char *hashfile)
u32 signature; u32 signature;
const int nread = fread (&signature, sizeof (u32), 1, fp); const size_t nread = fread (&signature, sizeof (u32), 1, fp);
if (nread != 1) return -1; if (nread != 1) return -1;

View File

@ -272,7 +272,7 @@ int straight_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (hc_path_is_directory (l0_filename) == true) if (hc_path_is_directory (l0_filename) == true)
{ {
char **dictionary_files = NULL; char **dictionary_files;
dictionary_files = scan_directory (l0_filename); dictionary_files = scan_directory (l0_filename);
@ -336,7 +336,7 @@ int straight_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (hc_path_is_directory (l0_filename) == true) if (hc_path_is_directory (l0_filename) == true)
{ {
char **dictionary_files = NULL; char **dictionary_files;
dictionary_files = scan_directory (l0_filename); dictionary_files = scan_directory (l0_filename);
@ -391,7 +391,7 @@ int straight_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (hc_path_is_directory (l0_filename) == true) if (hc_path_is_directory (l0_filename) == true)
{ {
char **dictionary_files = NULL; char **dictionary_files;
dictionary_files = scan_directory (l0_filename); dictionary_files = scan_directory (l0_filename);