Add SB Curated (copied from the smartbugs repository).
This commit is contained in:
30
dataset/arithmetic/token.sol
Normal file
30
dataset/arithmetic/token.sol
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* @source: https://github.com/sigp/solidity-security-blog
|
||||
* @author: Steve Marx
|
||||
* @vulnerable_at_lines: 20,22
|
||||
*/
|
||||
|
||||
pragma solidity ^0.4.18;
|
||||
|
||||
contract Token {
|
||||
|
||||
mapping(address => uint) balances;
|
||||
uint public totalSupply;
|
||||
|
||||
function Token(uint _initialSupply) {
|
||||
balances[msg.sender] = totalSupply = _initialSupply;
|
||||
}
|
||||
|
||||
function transfer(address _to, uint _value) public returns (bool) {
|
||||
// <yes> <report> ARITHMETIC
|
||||
require(balances[msg.sender] - _value >= 0);
|
||||
// <yes> <report> ARITHMETIC
|
||||
balances[msg.sender] -= _value;
|
||||
balances[_to] += _value;
|
||||
return true;
|
||||
}
|
||||
|
||||
function balanceOf(address _owner) public constant returns (uint balance) {
|
||||
return balances[_owner];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user