Sparkn

CodeFox Inc.
DeFiFoundryProxy
15,000 USDC
View results
Submission Details
Severity: low
Valid

Mismatch in Array Lengths

Summary

The code does not include any checks to ensure that the lengths of these array.

Vulnerability Details

In the provided code, there is a comment stating that the winners and percentages arrays are supposed not to be too long, implying that the loop should remain unbounded. However, the code does not include any checks to ensure that the lengths of these arrays match.

https://github.com/Cyfrin/2023-08-sparkn/blob/main/src/Distributor.sol#L108

* The winners and percentages array are supposed not to be so long, so the loop can stay unbounded

The following code snippet illustrates the loop where the issue may arise:

https://github.com/Cyfrin/2023-08-sparkn/blob/main/src/Distributor.sol#L128-L133

for (uint256 i; i < percentagesLength;) {
totalPercentage += percentages[i];
unchecked {
++i;
}
}

Impact

The absence of checks to ensure that the lengths of the winners and percentages arrays could result the loop can stay unbounded.

Tools Used

Manual Review

Support

FAQs

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