getMarketInfo
skipResults does not work
#53
Labels
2 (Med Risk)
bug
Something isn't working
disagree with severity
duplicate
This issue or pull request already exists
Handle
cmichel
Vulnerability details
The
RCFactory.getMarketInfo
function uses the same counter_resultNumber
for the result arrays' index.This counter is increased if
_skipResults
is set, and the arrays are therefore not indexed at zero.Imagine
_skipResults = marketInfoResults
to receive the second "page" of market infos. The function will just return an empty array of sizemarketInfoResults
because of thewhile(_resultNumber < marketInfoResults)
condition and increasing this same counter when skipping results.Impact
The function does not return the correct market infos if
_skipResults
is used.Recommended Mitigation Steps
The
_resultNumber
which is the index to the result arrays may not be increased when skipping results, instead a different counter should be used.The easiest way to fix this is by just decrementing the
_skipResults
variable itself.Change the
if (_resultNumber < _skipResults)
condition to:The text was updated successfully, but these errors were encountered: