InheritanceManager.sol::removeBeneficiary
function incorrectly uses delete to remove elements from the beneficiaries array, leaving stale address(0) entries and breaking critical logic that relies on the integrity of the array. This leads to incorrect fund distribution, failed transactions, and potential loss of funds.removeBeneficiary
uses delete beneficiaries[indexToRemove], which nullifies the entry at the specified index but does not reduce the array length. This results in:Stale Entries: The array retains address(0) after deletion.
Incorrect Indexing: Functions like _getBeneficiaryIndex return invalid indices for remaining entries.
Broken Assumptions: Functions iterating over beneficiaries (e.g., withdrawInheritedFunds) process null addresses, leading to failed transactions or ETH sent to address(0).
Output:
Which means after we deleted user2 who was at index1, user3 didn't go to index1, because when we use delete in array, we don't remove the element it is just set to address(0).
Fund Loss: withdrawInheritedFunds
may send assets to address(0)
.
Incorrect Calculations: buyOutEstateNFT
divides by the original array length, underpaying beneficiaries.
Failed Transactions: Functions expecting valid addresses will revert when encountering address(0)
.
Manual Review
Use pop
with Swap: Properly remove elements while maintaining array integrity:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.