Add SB Curated (copied from the smartbugs repository).
This commit is contained in:
33
dataset/time_manipulation/lottopollo.sol
Normal file
33
dataset/time_manipulation/lottopollo.sol
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* @source: https://github.com/seresistvanandras/EthBench/blob/master/Benchmark/Simple/timestampdependent.sol
|
||||
* @author: -
|
||||
* @vulnerable_at_lines: 13,27
|
||||
*/
|
||||
|
||||
pragma solidity ^0.4.0;
|
||||
contract lottopollo {
|
||||
address leader;
|
||||
uint timestamp;
|
||||
function payOut(uint rand) internal {
|
||||
// <yes> <report> TIME MANIPULATION
|
||||
if ( rand> 0 && now - rand > 24 hours ) {
|
||||
msg.sender.send( msg.value );
|
||||
|
||||
if ( this.balance > 0 ) {
|
||||
leader.send( this.balance );
|
||||
}
|
||||
}
|
||||
else if ( msg.value >= 1 ether ) {
|
||||
leader = msg.sender;
|
||||
timestamp = rand;
|
||||
}
|
||||
}
|
||||
function randomGen() constant returns (uint randomNumber) {
|
||||
// <yes> <report> TIME MANIPULATION
|
||||
return block.timestamp;
|
||||
}
|
||||
function draw(uint seed){
|
||||
uint randomNumber=randomGen();
|
||||
payOut(randomNumber);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user