BriVault

First Flight #52
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Impact: low
Likelihood: medium
Invalid

BriVault::getWinner() should have "winnerSet" modifier to prevent premature access

BriVault::getWinner() should have winnerSet modifier to prevent premature access

Description

The getWinner() function can be called even before the event winner is officially set.
This may cause it to return a zero address or an uninitialized value, leading to incorrect assumptions or unintended behavior in dependent functions or frontends.

function getWinner() public view returns (string memory) {
return winner;
}

Risk

Likelihood:

  • Whenever the getWinner() function is call even before the event winner is officially set.

Impact:

  • Causes inconsistent or misleading results.

Recommended Mitigation

Restrict access by adding the winnerSet modifier to ensure getWinner() can only be called after the winner has been determined:

-function getWinner() public view returns (address) {
+function getWinner() public view winnerSet returns (address) {
return winner;
}
Updates

Appeal created

bube Lead Judge 19 days ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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

Give us feedback!