Add SB Curated (copied from the smartbugs repository).
This commit is contained in:
36
dataset/denial_of_service/dos_address.sol
Normal file
36
dataset/denial_of_service/dos_address.sol
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* @source: https://github.com/SmartContractSecurity/SWC-registry/blob/master/test_cases/dos_gas_limit/dos_address.sol
|
||||
* @author: -
|
||||
* @vulnerable_at_lines: 16,17,18
|
||||
*/
|
||||
|
||||
pragma solidity ^0.4.25;
|
||||
|
||||
contract DosGas {
|
||||
|
||||
address[] creditorAddresses;
|
||||
bool win = false;
|
||||
|
||||
function emptyCreditors() public {
|
||||
// <yes> <report> DENIAL_OF_SERVICE
|
||||
if(creditorAddresses.length>1500) {
|
||||
creditorAddresses = new address[](0);
|
||||
win = true;
|
||||
}
|
||||
}
|
||||
|
||||
function addCreditors() public returns (bool) {
|
||||
for(uint i=0;i<350;i++) {
|
||||
creditorAddresses.push(msg.sender);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function iWin() public view returns (bool) {
|
||||
return win;
|
||||
}
|
||||
|
||||
function numberCreditors() public view returns (uint) {
|
||||
return creditorAddresses.length;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user