Beginner FriendlyFoundryGameFi
100 EXP
View results
Submission Details
Severity: low
Invalid

`setProducers` will cause redundancy in `producers` array

Summary

  • setProducers function will cause redundancy in producers array if called multiple times for the same producer

Vulnerability Details

  • if owner calls setProducers function multiple times for the same producer, the producer will be added to the producers array multiple times

  • this will cause the redundant producers in the producers array

function setProducers(address[] memory _producersList) public onlyOwner{
@> for (uint256 i = 0; i < _producersList.length; i++) {
isProducer[_producersList[i]] = true;
producers.push(_producersList[i]);
}
}

Impact

  • retundancy in producers array

  • getAllProducers function will return redundant producers if setProducers is called multiple times for the same producer

Tools Used

  • Manual review

Recommendations

  • Update setProducers function to check if producers are already set or not

function setProducers(address[] memory _producersList) public onlyOwner{
+ require(!isProducersSet, "Producers are already set");
for (uint256 i = 0; i < _producersList.length; i++) {
isProducer[_producersList[i]] = true;
producers.push(_producersList[i]);
}
}
Updates

Lead Judging Commences

bube Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Unbounded arrays

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.