Uno-Re / SSIP-SSRP-contracts

8 stars 4 forks source link

[L-03] Missing array length check #32

Open madMax92221 opened 10 months ago

madMax92221 commented 10 months ago

In buyPolicy() we have 4 array params which are all compared if they are equal to each other except the _assets array. Validate that all the arguments have the same length so you do not get unexpected errors if they don't.

function buyPolicy(
        address[] memory _assets, //@audit this param is not checked against the others
        address[] memory _protocols,
        uint256[] memory _coverageAmount,
        uint256[] memory _coverageDuration,
        uint256 _policyPriceInUSDC,
        uint256 _signedTime,
        address _premiumCurrency,
        bytes32 r,
        bytes32 s,
        uint8 v
    ) external payable whenNotPaused nonReentrant {
        uint256 len = _protocols.length;
        require(len > 0, "UnoRe: no policy");
        require(len == _coverageAmount.length, "UnoRe: no match protocolIds with coverageAmount");
        require(len == _coverageDuration.length, "UnoRe: no match protocolIds with coverageDuration");
wankhede04 commented 9 months ago

fixed at commit https://github.com/Uno-Re/SSIP-SSRP-contracts/commit/ab6376e10bfd02cca4aa40512a8ac08c92d68888