diff --git a/wallet/wallet.sol b/wallet/wallet.sol index c522a9b..2841312 100644 --- a/wallet/wallet.sol +++ b/wallet/wallet.sol @@ -330,14 +330,16 @@ contract Wallet is multisig, multiowned, daylimit { if (msg.value > 0) Deposit(msg.sender, msg.value); } - - // Outside-visible transact entry point. Executes transacion immediately if below daily spend limit. + + // Outside-visible transact entry point. Executes transaction immediately if below daily spend limit. // If not, goes into multisig process. We provide a hash on return to allow the sender to provide // shortcuts for the other confirmations (allowing them to avoid replicating the _to, _value // and _data arguments). They still get the option of using them if they want, anyways. function execute(address _to, uint _value, bytes _data) external onlyowner returns (bytes32 _r) { // first, take the opportunity to check that we're under the daily limit. - if (underLimit(_value)) { + // we also must check that there is no data (this is not a contract invocation), + // since we are unable to determine the value outcome of it. + if (underLimit(_value) && !hasCode(_to)) { SingleTransact(msg.sender, _value, _to, _data); // yes - just execute the call. _to.call.value(_value)(_data); @@ -373,6 +375,13 @@ contract Wallet is multisig, multiowned, daylimit { super.clearPending(); } + // Used to determine if an address may execute code + function hasCode(address _addr) internal constant returns (bool) { + uint size; + assembly { size := extcodesize(_addr) } + return size > 0; + } + // FIELDS // pending transactions we have at present.