The addBeneficiary
function in the provided code does not check if a beneficiary is already in the beneficiaries
array before adding them.
The addBeneficiary
function allows the addition of a beneficiary without verifying whether the beneficiary is already present in the beneficiaries
array. This can result in:
Duplicate Entries : The same beneficiary can be added multiple times, leading to repeated payouts.
Financial Losses : If the same beneficiary is added multiple times, they could receive payouts repeatedly, leading to financial losses for the contract.
Manual Code Review
Implement Duplicate Check :
Add a loop to check if _beneficiary
is already in the beneficiaries
array.
Use require
to ensure that _beneficiary
is not already present.
Validate Beneficiary Address :
Ensure that _beneficiary
is not the zero address (address(0)
).
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.