-
Notifications
You must be signed in to change notification settings - Fork 982
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of github.com:crytic/slither into dev
- Loading branch information
Showing
8 changed files
with
5,042 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
pragma solidity ^0.4.0; | ||
|
||
contract ReentrancyBenign { | ||
uint8 anotherVariableToChange; | ||
uint8 counter = 0; | ||
|
||
function bad0() public { | ||
if (!(msg.sender.call())) { | ||
revert(); | ||
} | ||
counter += 1; | ||
} | ||
|
||
function bad1(address target) public { | ||
(bool success) = target.call(); | ||
require(success); | ||
counter += 1; | ||
} | ||
|
||
function bad2(address target) public { | ||
(bool success) = target.call(); | ||
if (success) { | ||
address(target).call.value(1000)(); | ||
counter += 1; | ||
} | ||
else { | ||
revert(); | ||
} | ||
} | ||
|
||
function bad3(address target) public { | ||
externalCaller(target); | ||
varChanger(); | ||
ethSender(target); | ||
} | ||
|
||
function bad4(address target) public { | ||
externalCaller(target); | ||
ethSender(address(0)); | ||
varChanger(); | ||
address(target).call.value(2)(); | ||
} | ||
|
||
function bad5(address target) public { | ||
ethSender(address(0)); | ||
varChanger(); | ||
ethSender(address(0)); | ||
} | ||
|
||
function externalCaller(address target) private { | ||
address(target).call(); | ||
} | ||
|
||
function ethSender(address target) private { | ||
address(target).call.value(1)(); | ||
} | ||
|
||
function varChanger() private { | ||
anotherVariableToChange++; | ||
} | ||
} |
Oops, something went wrong.