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

A lack of parameter checks could lead to a system malfunction.

Summary

Absence of Parameter check could cause a system malfunction

Vulnerability Details

The 'getAccountsWithActivePositions' function takes in an 'upperbound' and `lowerbound` parameter
that gives the system a range of accountIDs to retrieve as seen below
```solidity```
/// @param lowerBound The lower bound of the accounts to retrieve.
/// @param upperBound The upper bound of the accounts to retrieve.
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++;
}
}
As seen above, the upperbound and lowerbound are intended to be used differently in the functions logic
to give the system a range of accountIDs to retrieve and work with but they could easily be interchanged wrongly
and this will make the function call fail

Impact

The upper bound and lower bound are meant to be used differently in the function's logic to define a range of
account IDs to retrieve and process. However, if they are mistakenly swapped, it will cause the function call
to fail.

Tools Used

Manual Analysis

Implement a check to ensure that upperbound is always greater than lowerbound

Updates

Lead Judging Commences

inallhonesty Lead Judge
about 1 year ago
inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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