Add SB Curated (copied from the smartbugs repository).
This commit is contained in:
21
dataset/arithmetic/insecure_transfer.sol
Normal file
21
dataset/arithmetic/insecure_transfer.sol
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* @source: https://consensys.github.io/smart-contract-best-practices/known_attacks/#front-running-aka-transaction-ordering-dependence
|
||||
* @author: consensys
|
||||
* @vulnerable_at_lines: 18
|
||||
*/
|
||||
|
||||
pragma solidity ^0.4.0;
|
||||
|
||||
contract IntegerOverflowAdd {
|
||||
mapping (address => uint256) public balanceOf;
|
||||
|
||||
// INSECURE
|
||||
function transfer(address _to, uint256 _value) public{
|
||||
/* Check if sender has balance */
|
||||
require(balanceOf[msg.sender] >= _value);
|
||||
balanceOf[msg.sender] -= _value;
|
||||
// <yes> <report> ARITHMETIC
|
||||
balanceOf[_to] += _value;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user