The loop iterates through each element in the stepList array and checks whether the new range overlaps with each existing range. However, the revert("Range overlap"); statement is placed inside the loop, which means that the moment any overlap is detected, the function will revert immediately without checking the remaining elements in the array.
Tools Used
Manual review
Recommended Mitigation Steps
To address this issue, you should modify the logic to use a boolean flag to track overlap and then revert outside of the loop if the flag is set. Here's the corrected code: Screenshot in link below
Lines of code
https://github.com/code-423n4/2023-08-goodentry/blob/71c0c0eca8af957202ccdbf5ce2f2a514ffe2e24/contracts/RangeManager.sol#L56-L68
Vulnerability details
Impact
The loop iterates through each element in the stepList array and checks whether the new range overlaps with each existing range. However, the revert("Range overlap"); statement is placed inside the loop, which means that the moment any overlap is detected, the function will revert immediately without checking the remaining elements in the array.
Tools Used
Manual review
Recommended Mitigation Steps
To address this issue, you should modify the logic to use a boolean flag to track overlap and then revert outside of the loop if the flag is set. Here's the corrected code: Screenshot in link below
https://ibb.co/mq6s3KC
Assessed type
Loop