change safe* to *

This commit is contained in:
Manuel Araoz
2017-04-19 16:19:22 -03:00
parent 4fad1505c7
commit 609869f087
8 changed files with 32 additions and 30 deletions

View File

@ -18,13 +18,15 @@ contract BasicToken is ERC20Basic {
* Fix for the ERC20 short address attack
*/
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
if(msg.data.length < size + 4) {
throw;
}
_;
}
function transfer(address _to, uint _value) onlyPayloadSize(2 * 32) {
balances[msg.sender] = balances[msg.sender].safeSub(_value);
balances[_to] = balances[_to].safeAdd(_value);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
}