mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-24 23:48:39 +00:00
Merge pull request #1105 from philsmd/master
rule engine: prevent integer underflow and dead code
This commit is contained in:
commit
aa8fa5ff6e
6
src/rp.c
6
src/rp.c
@ -663,6 +663,7 @@ int kernel_rule_to_cpu_rule (char *rule_buf, kernel_rule_t *rule)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
|
if (rule_pos == 0) return -1;
|
||||||
return rule_pos - 1;
|
return rule_pos - 1;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -670,14 +671,9 @@ int kernel_rule_to_cpu_rule (char *rule_buf, kernel_rule_t *rule)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rule_cnt > 0)
|
|
||||||
{
|
|
||||||
return rule_pos;
|
return rule_pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool kernel_rules_has_noop (const kernel_rule_t *kernel_rules_buf, const u32 kernel_rules_cnt)
|
bool kernel_rules_has_noop (const kernel_rule_t *kernel_rules_buf, const u32 kernel_rules_cnt)
|
||||||
{
|
{
|
||||||
for (u32 kernel_rules_pos = 0; kernel_rules_pos < kernel_rules_cnt; kernel_rules_pos++)
|
for (u32 kernel_rules_pos = 0; kernel_rules_pos < kernel_rules_cnt; kernel_rules_pos++)
|
||||||
|
Loading…
Reference in New Issue
Block a user