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

Merge pull request #3223 from philsmd/philsmd-rules-limit

prevent integer overflows in rp.c
This commit is contained in:
Jens Steube 2022-03-13 20:11:30 +01:00 committed by GitHub
commit cc794ed843
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -770,6 +770,13 @@ int kernel_rules_load (hashcat_ctx_t *hashcat_ctx, kernel_rule_t **out_buf, u32
{
rule_len = (u32) fgetl (&fp, rule_buf, HCBUFSIZ_LARGE);
if (rule_line >= 0xffffffff)
{
event_log_error (hashcat_ctx, "Unsupported number of lines in rule file %s", rp_file);
return -1;
}
rule_line++;
if (rule_len == 0) continue;
@ -807,6 +814,13 @@ int kernel_rules_load (hashcat_ctx_t *hashcat_ctx, kernel_rule_t **out_buf, u32
continue;
}
if (kernel_rules_cnt >= 0xffffffff)
{
event_log_error (hashcat_ctx, "Unsupported number of rules in file %s", rp_file);
return -1;
}
kernel_rules_cnt++;
}