aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenton Liu <liu.denton+github@gmail.com>2016-08-25 03:06:54 +0800
committerDenton Liu <liu.denton+github@gmail.com>2016-08-25 03:16:57 +0800
commit56558c0db2ad1e64aa81aaa05820388c2ba65a45 (patch)
treee3800fc37156f18ffb16b1215a4ec9f633906186
parent876b39e8e55c41ffc848dbb0f0210bde62dd511d (diff)
downloaddexon-solidity-56558c0db2ad1e64aa81aaa05820388c2ba65a45.tar.gz
dexon-solidity-56558c0db2ad1e64aa81aaa05820388c2ba65a45.tar.zst
dexon-solidity-56558c0db2ad1e64aa81aaa05820388c2ba65a45.zip
Check for overflow
-rw-r--r--std/StandardToken.sol4
1 files changed, 2 insertions, 2 deletions
diff --git a/std/StandardToken.sol b/std/StandardToken.sol
index d2567fec..db453492 100644
--- a/std/StandardToken.sol
+++ b/std/StandardToken.sol
@@ -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);
@@ -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);