From b568b21ae07587ee784bba2c25c7562207a4b027 Mon Sep 17 00:00:00 2001 From: fann95 Date: Tue, 31 Oct 2023 11:06:25 +0200 Subject: [PATCH] fix: issue-82 --- contracts/abstract/ApproveSwapAndPay.sol | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contracts/abstract/ApproveSwapAndPay.sol b/contracts/abstract/ApproveSwapAndPay.sol index a053ce7..5789c11 100644 --- a/contracts/abstract/ApproveSwapAndPay.sol +++ b/contracts/abstract/ApproveSwapAndPay.sol @@ -158,6 +158,9 @@ abstract contract ApproveSwapAndPay { // Maximizing approval if necessary _maxApproveIfNecessary(tokenIn, externalSwap.swapTarget, amountIn); uint256 balanceOutBefore = _getBalance(tokenOut); + (externalSwap.swapAmountInDataIndex > externalSwap.swapData.length / 0x20).revertError( + ErrLib.ErrorCode.INVALID_SWAP + ); // Patching the amount and calling the external swap externalSwap.swapTarget._patchAmountAndCall( externalSwap.swapData,