1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-16 19:58:25 +00:00

Replace some outdated error check

This commit is contained in:
jsteube 2016-11-12 15:27:11 +01:00
parent a3190986d4
commit b0a616084d

View File

@ -715,20 +715,13 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
return -1; return -1;
} }
u32 hccap_size = sizeof (hccap_t); char *in = (char *) hcmalloc (hashcat_ctx, sizeof (hccap_t)); VERIFY_PTR (in);
char *in = (char *) hcmalloc (hashcat_ctx, hccap_size); VERIFY_PTR (in);
while (!feof (fp)) while (!feof (fp))
{ {
int n = fread (in, hccap_size, 1, fp); const int nread = fread (in, sizeof (hccap_t), 1, fp);
if (n != 1) if (nread == 0) break;
{
if (hashes_cnt < 1) parser_status = PARSER_HCCAP_FILE_SIZE;
break;
}
if (hashes_avail == hashes_cnt) if (hashes_avail == hashes_cnt)
{ {
@ -737,7 +730,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
break; break;
} }
parser_status = hashconfig->parse_func ((u8 *) in, hccap_size, &hashes_buf[hashes_cnt], hashconfig); parser_status = hashconfig->parse_func ((u8 *) in, sizeof (hccap_t), &hashes_buf[hashes_cnt], hashconfig);
if (parser_status != PARSER_OK) if (parser_status != PARSER_OK)
{ {
@ -749,9 +742,9 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
hashes_cnt++; hashes_cnt++;
} }
fclose (fp);
hcfree (in); hcfree (in);
fclose (fp);
} }
else if (hashconfig->hash_mode == 3000) else if (hashconfig->hash_mode == 3000)
{ {
@ -1061,17 +1054,17 @@ int hashes_init_stage2 (hashcat_ctx_t *hashcat_ctx)
if (hashconfig->is_salted) if (hashconfig->is_salted)
{ {
salts_buf_new = (salt_t *) hccalloc (hashcat_ctx, hashes_cnt, sizeof (salt_t)); VERIFY_PTR (salts_buf_new); salts_buf_new = (salt_t *) hccalloc (hashcat_ctx, hashes_cnt, sizeof (salt_t)); VERIFY_PTR (salts_buf_new);
if (hashconfig->esalt_size)
{
esalts_buf_new = (void *) hccalloc (hashcat_ctx, hashes_cnt, hashconfig->esalt_size); VERIFY_PTR (esalts_buf_new);
}
} }
else else
{ {
salts_buf_new = (salt_t *) hccalloc (hashcat_ctx, 1, sizeof (salt_t)); VERIFY_PTR (salts_buf_new); salts_buf_new = (salt_t *) hccalloc (hashcat_ctx, 1, sizeof (salt_t)); VERIFY_PTR (salts_buf_new);
} }
if (hashconfig->esalt_size)
{
esalts_buf_new = (void *) hccalloc (hashcat_ctx, hashes_cnt, hashconfig->esalt_size); VERIFY_PTR (esalts_buf_new);
}
EVENT (EVENT_HASHLIST_SORT_SALT_PRE); EVENT (EVENT_HASHLIST_SORT_SALT_PRE);
u32 digests_cnt = hashes_cnt; u32 digests_cnt = hashes_cnt;