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

Missing Address Zero Check At Constructor

Relevant GitHub Link

https://github.com/Cyfrin/2024-07-the-predicter/blob/839bfa56fe0066e7f5610197a6b670c26a4c0879/src/ThePredicter.sol#L41

Summary

The constructor does not verify that the _scoreBoard address is a non-zero address. If a zero address is passed, it could lead to undefined behavior and potential security risks when interacting with the ScoreBoard contract.

Impact

If the scoreBoard address is set to the zero address, any function calls to the ScoreBoard contract will fail, resulting in the contract not functioning as intended. This can cause the entire ThePredicter contract to be unusable.

Tools Used

Manual Reading

Recommendations

Add a check in the constructor to ensure that the _scoreBoard address is not the zero address

constructor(
address _scoreBoard,
uint256 _entranceFee,
uint256 _predictionFee
) {
if (_scoreBoard == address(0)) {
revert ThePredicter__InvalidScoreBoardAddress();
}
organizer = msg.sender;
scoreBoard = ScoreBoard(_scoreBoard);
entranceFee = _entranceFee;
predictionFee = _predictionFee;
}
Updates

Lead Judging Commences

NightHawK Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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