code-423n4 / 2021-08-realitycards-findings

1 stars 0 forks source link

RCFactory: Skipping results don't work as intended in getMarketInfo() #40

Closed code423n4 closed 3 years ago

code423n4 commented 3 years ago

Handle

hickuphh3

Vulnerability details

Impact

_skipResults is intended to help break up fetching market info for a given mode into multiple calls. Let us assume that the total market size for a mode is N, where N > marketInfoResults, the number of results to return. However, the current implementation will return null values for the first _skipResults indexes. This means that if _skipResults >= marketInfoResults, the returned values will all be null, which is not the expected behaviour.

Proof of Concept

Assume the following:

The first call to retrieve the latest 20 markets (because iteration starts from the back) for the specified mode will be fine. An attempt to retrieve the next 20 markets is performed by calling getMarketInfo() with _skipResults = 20.

Splidge commented 3 years ago

Duplicate of #14