Split controlled-delegatecall + too-many-digits findings into separate results

pull/226/head
David Pokora 6 years ago
parent 5725162904
commit 142b69b70e
No known key found for this signature in database
GPG Key ID: 3CED48D1BB21BDD7
  1. 14
      slither/detectors/statements/controlled_delegatecall.py
  2. 14
      slither/detectors/statements/too_many_digits.py

@ -46,14 +46,14 @@ Bob calls `delegate` and delegates the execution to its malicious contract. As a
continue
nodes = self.controlled_delegatecall(f)
if nodes:
info = '{}.{} ({}) uses delegatecall to a input-controlled function id\n'
info = info.format(contract.name, f.name, f.source_mapping_str)
func_info = '{}.{} ({}) uses delegatecall to a input-controlled function id\n'
func_info = func_info.format(contract.name, f.name, f.source_mapping_str)
for node in nodes:
info += '\t{} ({})\n'.format(node.expression, node.source_mapping_str)
node_info = func_info + '\t- {} ({})\n'.format(node.expression, node.source_mapping_str)
json = self.generate_json_result(info)
self.add_function_to_json(f, json)
self.add_nodes_to_json(nodes, json)
results.append(json)
json = self.generate_json_result(node_info)
self.add_node_to_json(node, json)
self.add_function_to_json(f, json)
results.append(json)
return results

@ -64,17 +64,15 @@ Use:
# iterate over all the nodes
ret = self._detect_too_many_digits(f)
if ret:
info = '{}.{} ({}) uses literals with too many digits:'.format(f.contract.name,
func_info = '{}.{} ({}) uses literals with too many digits:'.format(f.contract.name,
f.name,
f.source_mapping_str)
for node in ret:
info += '\n\t- {}'.format(node.expression)
info += '\n\tUse the proper denomination (ether-unit, time-unit,'
info += 'or the scientific notation\n'
node_info = func_info + '\n\t- {}\n'.format(node.expression)
# Add the result in result
json = self.generate_json_result(info)
self.add_nodes_to_json(ret, json)
results.append(json)
# Add the result in result
json = self.generate_json_result(node_info)
self.add_node_to_json(node, json)
results.append(json)
return results

Loading…
Cancel
Save