The function does not validate _routeNumber before accessing the mappings routes, swapParams, and pools. If _routeNumber > nRoutes, the mappings will return default values, such as address(0) for addresses and 0 for integers, potentially leading to an invalid transaction.
Passing invalid parameters to router.exchange can cause the transaction to revert or execute with unintended behavior, leading to wasted gas or protocol disruption.
Manual code review.
Add a validation check to ensure _routeNumber is within the valid range:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.