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

Input arrays with mismatched length will make giveLoan() throw exception

Vulnerability Details

The giveLoan() function in Lender.sol contract, in charge of bringing the loan to new pools on the choice of the old loans' lender, simultaneously iterates over both arrays based on the length of just one of them (loanIds). If the number of elements in poolIds is less than that in loanIds, the whole transaction will be reverted for attempting to access an out-of-bounds index.

https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L359

359 for (uint256 i = 0; i < loanIds.length; i++) {...}

Impact

Hard to know where the issue is as there is no actual message returned on failure.

Tools Used

Manual

Recommendations

  1. Consider including a require clause with an explicit error message to check for matching array length.

Support

FAQs

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