Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input arrays with mismatched length will make giveLoan to throw #2100

Open
codehawks-bot opened this issue Aug 8, 2023 · 0 comments
Open

Comments

@codehawks-bot
Copy link

Input arrays with mismatched length will make giveLoan to throw

Severity

Low Risk

Relevant GitHub Links

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

The giveLoan function, in charge of allowing lenders to transfer loan (loanIds) to give to a respective pool (poolIds), 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.
The whole transaction will be reverted

Recommendations

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants