Closed code423n4 closed 2 years ago
https://github.com/code-423n4/2022-06-putty/blob/3b6b844bc39e897bd0bbb69897f2deff12dc3893/contracts/src/PuttyV2.sol#L405 https://github.com/code-423n4/2022-06-putty/blob/3b6b844bc39e897bd0bbb69897f2deff12dc3893/contracts/src/PuttyV2.sol#L297
Invalid condition check could lead to unexpected consequences
require(floorAssetTokenIds.length == order.floorTokens.length, "Wrong amount of floor tokenIds") require(floorAssetTokenIds.length == order.floorTokens.length, "Wrong amount of floor tokenIds")
what is the both token array length is zero. i this case, it may get executed.
VS code
Include validity check like both the token array length should be greater than zero.
Order can have zero floor tokens
Confirming what @GalloDaSballo said
Lines of code
https://github.com/code-423n4/2022-06-putty/blob/3b6b844bc39e897bd0bbb69897f2deff12dc3893/contracts/src/PuttyV2.sol#L405 https://github.com/code-423n4/2022-06-putty/blob/3b6b844bc39e897bd0bbb69897f2deff12dc3893/contracts/src/PuttyV2.sol#L297
Vulnerability details
Impact
Invalid condition check could lead to unexpected consequences
Proof of Concept
require(floorAssetTokenIds.length == order.floorTokens.length, "Wrong amount of floor tokenIds") require(floorAssetTokenIds.length == order.floorTokens.length, "Wrong amount of floor tokenIds")
what is the both token array length is zero. i this case, it may get executed.
Tools Used
VS code
Recommended Mitigation Steps
Include validity check like both the token array length should be greater than zero.