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

Division by Zero Risk In InheritanceManager::buyOutEstateNFT Leading to Tranasction Reversion

Summary: InheritanceManager::buyOutEstateNFT divides by beneficiaries.length without checking if it’s zero.

Vulnerability Details: InheritanceManager::buyOutEstateNFT divides by beneficiaries.length without checking if it’s zero.

//@audit --> Possible division by zero, no checks for zero divisor
function buyOutEstateNFT(uint256 _nftID) external onlyBeneficiaryWithIsInherited {
uint256 value = nftValue[_nftID];
uint256 divisor = beneficiaries.length;
uint256 multiplier = beneficiaries.length - 1;
uint256 finalAmount = (value / divisor) * multiplier;
IERC20(assetToPay).safeTransferFrom(msg.sender, address(this), finalAmount);
for (uint256 i = 0; i < beneficiaries.length; i++) {
if (msg.sender == beneficiaries[i]) {
return;
} else {
IERC20(assetToPay).safeTransfer(beneficiaries[i], finalAmount / divisor);
}

Impact: If beneficiaries.length == 0, funds become inaccessible, and transactions fail, wasting gas.

Tools Used: Foundry

Recommendations: Added check for possible zero divisor

//@audit --> Added check for zero divisor
require(beneficiaries.length > 0, "No beneficiaries present");
IERC20(assetToPay).safeTransfer(beneficiaries[i], finalAmount / divisor);
Updates

Lead Judging Commences

0xtimefliez Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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