mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-25 07:58:19 +00:00
Improved dictstat header check
This commit is contained in:
parent
822ae7b9a9
commit
2670791916
@ -103,22 +103,37 @@ void dictstat_read (hashcat_ctx_t *hashcat_ctx)
|
|||||||
{
|
{
|
||||||
event_log_error (hashcat_ctx, "%s: Invalid header", dictstat_ctx->filename);
|
event_log_error (hashcat_ctx, "%s: Invalid header", dictstat_ctx->filename);
|
||||||
|
|
||||||
|
fclose (fp);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
v = byte_swap_64 (v);
|
v = byte_swap_64 (v);
|
||||||
z = byte_swap_64 (z);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (z != 0)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user