The SpookySwap contract's constructor allows duplicate treat names to be added during initialization, potentially leading to data inconsistency and unexpected behavior in the treat management system.
The contract initializes treats in the constructor without checking for duplicates:
The issue extends to the addTreat
function which is called by the constructor:
Example of problematic initialization:
This leads to:
The treatList
mapping will only store the last entry for "Candy"
The treatNames
array will contain duplicate entries
Original cost and URI information for the first "Candy" entry will be lost
Data inconsistency between treatList
and treatNames
Misleading enumeration of available treats
Potential confusion for users and front-end applications
Incorrect statistics about the number of unique treats
Manual review
Add duplicate check in constructor:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.