Skip to content

Commit

Permalink
Check transfer destination is not a zero address. Fix issue OpenZeppe…
Browse files Browse the repository at this point in the history
  • Loading branch information
pash7ka committed Aug 23, 2017
1 parent 47aa4bb commit c2d667c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions contracts/token/BasicToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ contract BasicToken is ERC20Basic {
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) returns (bool) {
require(_to != address(0));

balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
Expand Down
1 change: 1 addition & 0 deletions contracts/token/StandardToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ contract StandardToken is ERC20, BasicToken {
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) returns (bool) {
require(_to != address(0));
var _allowance = allowed[_from][msg.sender];

// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
Expand Down

0 comments on commit c2d667c

Please sign in to comment.