Closed sherlock-admin2 closed 3 weeks ago
Jovial Tan Donkey
Low/Info
In EthosDiscussion.sol when creating a reply via addReply(), the reply is stored incorrectly.
The booleanbool isTargetThisContract is from Line 115. Where the function isAddressThisContract() returns true if 'targetContract' is EthosDiscussion.
isTargetThisContract
bool isTargetThisContract = _isAddressThisContract(targetContract); function _isAddressThisContract(address targetContract) private view returns (bool) { return targetContract == address(this); }
However, the boolean is stored in reverse.
function addReply( address targetContract, uint256 targetId, string memory content, string memory metadata ) replies[_replyCount] = Reply( @> !isTargetThisContract, targetContract, authorID, _replyCount, targetId, block.timestamp, 0, content, metadata );
No response
Fix the typo
replies[_replyCount] = Reply( - !isTargetThisContract, + isTargetThisContract, targetContract, authorID, _replyCount, targetId, block.timestamp, 0, content, metadata );
Jovial Tan Donkey
Low/Info
Wrong storage of Reply in EthosDiscussion.sol
Summary
In EthosDiscussion.sol when creating a reply via addReply(), the reply is stored incorrectly.
Root Cause
The booleanbool
isTargetThisContract
is from Line 115. Where the function isAddressThisContract() returns true if 'targetContract' is EthosDiscussion.However, the boolean is stored in reverse.
Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
No response
Impact
No response
PoC
No response
Mitigation
Fix the typo