Static Analyzer for Solidity
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
slither/tests/arbitrary_send.sol

42 lines
810 B

contract Test{
address destination;
mapping (address => uint) balances;
constructor(){
balances[msg.sender] = 0;
}
function direct(){
msg.sender.send(this.balance);
}
function init(){
destination = msg.sender;
}
function indirect(){
destination.send(this.balance);
}
// these are legitimate calls
// and should not be detected
function repay() payable{
msg.sender.transfer(msg.value);
}
function withdraw(){
uint val = balances[msg.sender];
msg.sender.send(val);
}
function buy() payable{
uint value_send = msg.value;
uint value_spent = 0 ; // simulate a buy of tokens
uint remaining = value_send - value_spent;
msg.sender.send(remaining);
}
}