1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-24 23:48:39 +00:00

Improved dictstat header check

This commit is contained in:
jsteube 2017-10-02 15:44:03 +02:00
parent 822ae7b9a9
commit 2670791916

View File

@ -103,22 +103,37 @@ void dictstat_read (hashcat_ctx_t *hashcat_ctx)
{
event_log_error (hashcat_ctx, "%s: Invalid header", dictstat_ctx->filename);
fclose (fp);
return;
}
v = byte_swap_64 (v);
z = byte_swap_64 (z);
if (v != DICTSTAT_VERSION)
if ((v & 0xffffffffffffff00) != (DICTSTAT_VERSION & 0xffffffffffffff00))
{
event_log_error (hashcat_ctx, "%s: Invalid header", dictstat_ctx->filename);
event_log_error (hashcat_ctx, "%s: Invalid header, ignoring content", dictstat_ctx->filename);
fclose (fp);
return;
}
if (z != 0)
{
event_log_error (hashcat_ctx, "%s: Invalid header", dictstat_ctx->filename);
event_log_error (hashcat_ctx, "%s: Invalid header, ignoring content", dictstat_ctx->filename);
fclose (fp);
return;
}
if ((v & 0xff) < (DICTSTAT_VERSION & 0xff))
{
event_log_warning (hashcat_ctx, "%s: Outdated header version, ignoring content", dictstat_ctx->filename);
fclose (fp);
return;
}