20,000 USDC
View results
Submission Details
Severity: gas
Valid

Jagged arrays length not checked

Summary

A jagged array is used in Lender.sol and lengths not checked.

function giveLoan(
uint256[] calldata loanIds,
bytes32[] calldata poolIds
) external {
for (uint256 i = 0; i < loanIds.length; i++) {
uint256 loanId = loanIds[i];
bytes32 poolId = poolIds[i];
//....
}
}

Vulnerability Details

if length of loanIds is greater than poolIds array, the derived poolId will be wrong,

Impact

The pool owner might not be able to give away a Loan

Tools Used

Manual review

Recommendations

Check if both arrays are equal.

if(loanIds.length != poolIds.length){
revert ArrayLenghtMismatch()
}

Support

FAQs

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

Give us feedback!