Skip to content

[L-03] Missing array length check #32

@madMax92221

Description

@madMax92221

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");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions