Detect suicidal external function (fix #527)

pull/530/head
Josselin 4 years ago
parent 64ecdbec9a
commit fa8deb6214
  1. 4
      slither/detectors/functions/suicidal.py

@ -46,7 +46,7 @@ Bob calls `kill` and destructs the contract.'''
if func.is_constructor: if func.is_constructor:
return False return False
if func.visibility != 'public': if func.visibility not in ['public', 'external']:
return False return False
calls = [c.name for c in func.internal_calls] calls = [c.name for c in func.internal_calls]
@ -60,7 +60,7 @@ Bob calls `kill` and destructs the contract.'''
def detect_suicidal(self, contract): def detect_suicidal(self, contract):
ret = [] ret = []
for f in [f for f in contract.functions if f.contract_declarer == contract]: for f in contract.functions_declared:
if self.detect_suicidal_func(f): if self.detect_suicidal_func(f):
ret.append(f) ret.append(f)
return ret return ret

Loading…
Cancel
Save