Note that with the current implementation, if _tokenURIs is of odd length, its last element will be redundant, but market creation will not revert.
The stricter checks will partially mitigate _tokenURIs having odd length because _cardAffiliateAddresses is now required to be exactly twice that of _tokenURIs.
Handle
hickuphh3
Vulnerability details
Impact
Solidity division rounds down, so doing
M / 2 <= N
checks mean thatM
can be at most2N + 1
.This affects the following checks:
Note that with the current implementation, if
_tokenURIs
is of odd length, its last element will be redundant, but market creation will not revert.The stricter checks will partially mitigate
_tokenURIs
having odd length because_cardAffiliateAddresses
is now required to be exactly twice that of_tokenURIs
.Recommended Mitigation Steps
These checks should be modified to
In addition, consider adding a check for
_tokenURIs
to strictly be of even length.require(_tokenURIs.length % 2 == 0, "TokenURI Length Error");