Skip to content

Commit

Permalink
Check for overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Denton-L committed Aug 24, 2016
1 parent 876b39e commit 56558c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions std/StandardToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ contract StandardToken is Token {
}

function transfer(address _to, uint256 _value) returns (bool success) {
if (balanceOf[msg.sender] >= _value) {
if (balanceOf[msg.sender] >= _value && balanceOf[_to] + _value >= balanceOf[_to]) {
balanceOf[msg.sender] -= _value;
balanceOf[_to] += _value;
Transfer(msg.sender, _to, _value);
Expand All @@ -24,7 +24,7 @@ contract StandardToken is Token {
}

function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
if (allowance[_from][msg.sender] >= _value) {
if (allowance[_from][msg.sender] >= _value && balanceOf[_to] + _value >= balanceOf[_to]) {
allowance[_from][msg.sender] -= _value;
balanceOf[_to] += _value;
Transfer(_from, _to, _value);
Expand Down

0 comments on commit 56558c0

Please sign in to comment.