diff --git a/slither/detectors/statements/incorrect_strict_equality.py b/slither/detectors/statements/incorrect_strict_equality.py index bc7b0cebe..bd34d61b1 100644 --- a/slither/detectors/statements/incorrect_strict_equality.py +++ b/slither/detectors/statements/incorrect_strict_equality.py @@ -72,6 +72,14 @@ contract Crowdsale{ def is_direct_comparison(ir: Operation) -> bool: return isinstance(ir, Binary) and ir.type == BinaryType.EQUAL + @staticmethod + def is_not_comparing_addresses(ir: Binary) -> bool: + """ + Comparing addresses strictly should not be flagged. + """ + addr = ElementaryType("address") + return ir.variable_left.type != addr or ir.variable_right.type != addr + @staticmethod def is_any_tainted( variables: List[ @@ -145,7 +153,12 @@ contract Crowdsale{ for ir in node.irs_ssa: # Filter to only tainted equality (==) comparisons - if self.is_direct_comparison(ir) and self.is_any_tainted(ir.used, taints, func): + if ( + self.is_direct_comparison(ir) + and self.is_not_comparing_addresses(ir) + and self.is_any_tainted(ir.used, taints, func) + ): + # if func not in results: results[func] = [] results[func].append(node)