Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: low
Invalid

getBeneficiaryIndex state for position 0 is incorrect

Summary

when function getBeneficiaryIndex return 0 it is not really clear if the item does not exisit (returns 0) or the item is at position 0(returns 0). hence it returns 0 fir different confditions.

Vulnerability Details

function test_getBeneficiaryIndex() public {
vm.startPrank(owner);
im.addBeneficiery(user1);
console.log("get user1:", im._getBeneficiaryIndex(user1));
console.log("get whatever 0x1234:", im._getBeneficiaryIndex(address(0x1234)));
assertEq(
im._getBeneficiaryIndex(user1),
im._getBeneficiaryIndex(address(0x1234))
);
}

Impact

Not critical at present as fucntion is not used for itnernal logic, but if in furutre it is used this behaviour might trigger erros

Tools Used

foundry

Recommendations

distinguish between conditions buy reverting or returning -1

Updates

Lead Judging Commences

0xtimefliez Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Appeal created

mishoko Submitter
3 months ago
0xtimefliez Lead Judge
3 months ago
0xtimefliez Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.