Created
June 18, 2016 03:49
-
-
Save drandreaskrueger/65a063b0135633c9e050316b8398a8bf to your computer and use it in GitHub Desktop.
Scanning Live Ethereum Contracts for the "Unchecked-Send" Bug - suggestion for listing 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** Listing 3 - would this be an improvement? ***/ | |
/*** ***/ | |
/*** inspired by excellent article ***/ | |
/*** http://hackingdistributed.com/2016/06/16/scanning-live-ethereum-contracts-for-bugs ***/ | |
if (gameHasEnded && !( prizePaidOutToWinner ) ) { | |
if (winner.send(1000)) | |
prizePaidOutToWinner = True; | |
} | |
if (gameHasEnded && !( prizePaidOutToLooser ) ) { | |
if (loser.send(10)) | |
prizePaidOutToLooser = True; | |
} | |
if !(prizePaidOutToWinner && prizePaidOutToLooser){ | |
throw; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment