some security fixes

pull/14/head
Manuel Araoz 9 years ago
parent c543282f40
commit 30c0600ac1
  1. 5
      contracts/BadPushPayments.sol
  2. 2
      contracts/GoodPullPayments.sol
  3. 2
      contracts/PullPaymentCapable.sol

@ -9,7 +9,10 @@ contract BadPushPayments {
if (msg.value < highestBid) throw;
if (highestBidder != 0) {
highestBidder.send(highestBid);
// return bid to previous winner
if (!highestBidder.send(highestBid)) {
throw;
}
}
highestBidder = msg.sender;

@ -14,7 +14,7 @@ contract GoodPullPayments {
highestBid = msg.value;
}
function withdrawRefund() external {
function withdrawBid() external {
uint refund = refunds[msg.sender];
refunds[msg.sender] = 0;
if (!msg.sender.send(refund)) {

@ -1,7 +1,7 @@
contract PullPaymentCapable {
mapping(address => uint) refunds;
function asyncSend(address dest, uint amount) {
function asyncSend(address dest, uint amount) internal {
refunds[dest] += amount;
}

Loading…
Cancel
Save