DeFiFoundry
60,000 USDC
View results
Submission Details
Severity: medium
Invalid

Missing Return Statement | Causing the Protocol to Return `0` Always

Summary:

For example the function getAccountsWithActivePositions is designed to return an array of account IDs with active positions within a specified range. However, it does not include a return statement, leading to the caller not receiving the expected data. This omission can cause significant issues in any system relying on this function to retrieve account information.

Vulnerability Details:

Impact:

The lack of a return statement prevents the function from fulfilling its intended purpose, leading to:

  • Functionality Issues: Any external calls to getAccountsWithActivePositions will not receive the expected data, causing malfunctions in dependent contracts or systems.

  • Operational Disruptions: Systems relying on this function to retrieve active positions for further processing or decision-making will encounter failures or incorrect behavior.

Tools Used:

Manual Review

Recommendations:

Add Return Statement: Include a return statement at the end of the function.

function getAccountsWithActivePositions(
uint256 lowerBound,
uint256 upperBound
)
external
view
returns (uint128[] memory accountsIds)
{
GlobalConfiguration.Data storage globalConfiguration = GlobalConfiguration.load();
accountsIds = new uint128[](upperBound - lowerBound + 1);
uint256 index = 0;
for (uint256 i = lowerBound; i <= upperBound; i++) {
accountsIds[index] = uint128(globalConfiguration.accountsIdsWithActivePositions.at(i));
index++;
}
+ return accountsIds;
}
Updates

Lead Judging Commences

inallhonesty Lead Judge
about 1 year ago
inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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