smartbugs-curated/dataset/denial_of_service/dos_simple.sol

28 lines
621 B
Solidity

/*
* @source: https://github.com/SmartContractSecurity/SWC-registry/blob/master/test_cases/dos_gas_limit/dos_simple.sol
* @author: -
* @vulnerable_at_lines: 17,18
*/
pragma solidity ^0.4.25;
contract DosOneFunc {
address[] listAddresses;
function ifillArray() public returns (bool){
if(listAddresses.length<1500) {
// <yes> <report> DENIAL_OF_SERVICE
for(uint i=0;i<350;i++) {
listAddresses.push(msg.sender);
}
return true;
} else {
listAddresses = new address[](0);
return false;
}
}
}