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

Missing check if loans and pools arrays are equal length

Summary

Function giveLoan() doesn’t check whether loanIds and poolIds arrays have the same length.

Vulnerability Details

There is no check if loanIds.length and poolIds.length are equal. To match the selling loan to the new pool.

Impact

If loanIds array is longer the function will revert when checking if pool.loanToken != loan.loanToken because all of the pool members will be default and pool.loanToken will be equal to zero address.

Tools Used

Manual

Recommendations

Add a check in the start of the function to confirm that loanIds and poolIds have equal length.

function giveLoan(uint256[] calldata loanIds, bytes32[] calldata poolIds) external {
if (loanIds.length != poolIds.length) revert MismatchedArrayLengths();
for (uint256 i = 0; i < loanIds.length; i++) {
...
}

Support

FAQs

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