Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit 5dcf2be

Browse files
committed
Add multisig support for data in transactions or if destination address has code
1 parent 0aeff24 commit 5dcf2be

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

wallet/wallet.sol

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,9 @@ contract Wallet is multisig, multiowned, daylimit {
337337
// and _data arguments). They still get the option of using them if they want, anyways.
338338
function execute(address _to, uint _value, bytes _data) external onlyowner returns (bytes32 _r) {
339339
// first, take the opportunity to check that we're under the daily limit.
340-
if (underLimit(_value)) {
340+
// we also must check that there is no data (this is not a contract invocation),
341+
// since we are unable to determine the value outcome of it.
342+
if (underLimit(_value) && _data.length == 0 && !hasCode(_to)) {
341343
SingleTransact(msg.sender, _value, _to, _data);
342344
// yes - just execute the call.
343345
_to.call.value(_value)(_data);
@@ -373,6 +375,13 @@ contract Wallet is multisig, multiowned, daylimit {
373375
super.clearPending();
374376
}
375377

378+
// Used to determine if an address may execute code
379+
function hasCode(address _addr) returns (bool) {
380+
uint size;
381+
assembly { size := extcodesize(_addr) }
382+
return size > 0;
383+
}
384+
376385
// FIELDS
377386

378387
// pending transactions we have at present.

0 commit comments

Comments
 (0)