Add SB Curated (copied from the smartbugs repository).
This commit is contained in:
28
dataset/reentrancy/reentrancy_dao.sol
Normal file
28
dataset/reentrancy/reentrancy_dao.sol
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* @source: https://github.com/ConsenSys/evm-analyzer-benchmark-suite
|
||||
* @author: Suhabe Bugrara
|
||||
* @vulnerable_at_lines: 18
|
||||
*/
|
||||
|
||||
pragma solidity ^0.4.19;
|
||||
|
||||
contract ReentrancyDAO {
|
||||
mapping (address => uint) credit;
|
||||
uint balance;
|
||||
|
||||
function withdrawAll() public {
|
||||
uint oCredit = credit[msg.sender];
|
||||
if (oCredit > 0) {
|
||||
balance -= oCredit;
|
||||
// <yes> <report> REENTRANCY
|
||||
bool callResult = msg.sender.call.value(oCredit)();
|
||||
require (callResult);
|
||||
credit[msg.sender] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
function deposit() public payable {
|
||||
credit[msg.sender] += msg.value;
|
||||
balance += msg.value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user