After looking at many different custom token contracts I noticed that the standard of transferFrom() function is as follows:
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
// some code...
balances[_from] = balances[_from] -= _value;
balances[_to] = balances[_to] += _value;
allowed[_from][msg.sender] = allowed[_from][msg.sender] -= _value;
// some code...
}
Would this function be vulnerable to any kind of attack if these lines:
balances[_from] = balances[_from] -= _value;
balances[_to] = balances[_to] += _value;
were in opposite order:
balances[_to] = balances[_to] += _value;
balances[_from] = balances[_from] -= _value;
or there is no case in which a malicious user could hack this code?