Fix for #400: Check that destination of token transfers is not 0x

This commit is contained in:
Pavel Rubin
2017-08-28 21:00:29 +03:00
committed by Francisco Giordano
parent 307d34e05a
commit 209e2de93b
2 changed files with 4 additions and 0 deletions

View File

@ -20,6 +20,8 @@ contract BasicToken is ERC20Basic {
* @param _value The amount to be transferred. * @param _value The amount to be transferred.
*/ */
function transfer(address _to, uint256 _value) returns (bool) { function transfer(address _to, uint256 _value) returns (bool) {
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value); balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value); balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value); Transfer(msg.sender, _to, _value);

View File

@ -24,6 +24,8 @@ contract StandardToken is ERC20, BasicToken {
* @param _value uint256 the amount of tokens to be transferred * @param _value uint256 the amount of tokens to be transferred
*/ */
function transferFrom(address _from, address _to, uint256 _value) returns (bool) { function transferFrom(address _from, address _to, uint256 _value) returns (bool) {
require(_to != address(0));
var _allowance = allowed[_from][msg.sender]; var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met